List of usage examples for android.util Log isLoggable
public static native boolean isLoggable(String tag, int level);
From source file:com.yzx.frames.tool.view_self.percent.PercentLayoutHelper.java
/** * Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from * {@code LayoutParams(Context c, AttributeSet attrs)} constructor. *//*ww w .j av a 2 s. c o m*/ public static PercentLayoutInfo getPercentLayoutInfo(Context context, AttributeSet attrs) { PercentLayoutInfo info = null; TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.PercentLayout_Layout); float value = array.getFraction(R.styleable.PercentLayout_Layout_layout_widthPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent width: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.widthPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_heightPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent height: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.heightPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.leftMarginPercent = value; info.topMarginPercent = value; info.rightMarginPercent = value; info.bottomMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginLeftPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent left margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.leftMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginTopPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent top margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.topMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginRightPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent right margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.rightMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginBottomPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent bottom margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.bottomMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginStartPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent start margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.startMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginEndPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent end margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.endMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_aspectRatio, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "aspect ratio: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.aspectRatio = value; } array.recycle(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "constructed: " + info); } return info; }
From source file:com.samsung.spen.SpenPlugin.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (Log.isLoggable(Utils.SPEN, Log.DEBUG)) { Log.d(TAG, "Inside onActivityResult"); Log.d(TAG, "Intent: " + intent + ", requestCode: " + requestCode); }//from www .ja va 2 s .com if (requestCode == Utils.REQUEST_CODE_SELECT_IMAGE_BACKGROUND) { if (Log.isLoggable(Utils.SPEN, Log.DEBUG)) { Log.d(TAG, "on background image selected"); } if (mCurrentSurfaceType == Utils.SURFACE_INLINE) { mSpenSurfaceViews.getSurfaceView(mCurrentWorkingId).setasBgImage(intent); } else { Message msgObj = setBgHandler.obtainMessage(); Bundle b = new Bundle(); b.putParcelable("intent", intent); msgObj.setData(b); setBgHandler.sendMessage(msgObj); } } else { if (Log.isLoggable(Utils.SPEN, Log.DEBUG)) { Log.d(TAG, "request code is not matching"); } } }
From source file:com.binomed.showtime.android.util.localisation.LocationUtils.java
public static void registerLocalisationListener(final Context context, final ProviderEnum provider, final LocalisationManagement listener) { switch (provider) { case GPS_PROVIDER: case GSM_PROVIDER: { if (isLocalisationEnabled(context, provider)) { LocationManager locationManager = getLocationManager(context); if (locationManager != null) { locationManager.requestLocationUpdates(provider.getAndroidProvider(), 10000, 10, listener); } else { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "No listener Put"); //$NON-NLS-1$ listener.onProviderDisabled(null); }/* w ww. j av a 2s . c o m*/ } } else { listener.onProviderDisabled(null); } break; } case IP_PROVIDER: case WIFI_PROVIDER: case XPS_PROVIDER: { final XPS xps = listener.getXps(); final WPSAuthentication auth = listener.getWpsAuth(); xps.registerUser(auth, null, new RegistrationCallback() { @Override public WPSContinuation handleError(WPSReturnCode error) { switch (error) { case WPS_ERROR_LOCATION_CANNOT_BE_DETERMINED: { Log.e(TAG, error.toString()); break; } case WPS_ERROR_WIFI_NOT_AVAILABLE: { Log.e(TAG, error.toString()); break; } case WPS_ERROR_SERVER_UNAVAILABLE: { Log.e(TAG, error.toString()); break; } case WPS_ERROR_NO_WIFI_IN_RANGE: { Log.e(TAG, error.toString()); break; } case WPS_ERROR: { Log.e(TAG, error.name()); break; } default: Log.e(TAG, error.name()); break; } // TODO grer les cas d'erreur // in all case, we'll stop return WPSContinuation.WPS_STOP; } @Override public void done() { Log.i(TAG, "Registration Done ! "); } @Override public void handleSuccess() { switch (provider) { case IP_PROVIDER: { xps.getIPLocation(auth // , WPSStreetAddressLookup.WPS_LIMITED_STREET_ADDRESS_LOOKUP // , listener// ); break; } case WIFI_PROVIDER: { xps.getLocation(auth // , WPSStreetAddressLookup.WPS_LIMITED_STREET_ADDRESS_LOOKUP // , listener// ); break; } case XPS_PROVIDER: { xps.getXPSLocation(auth // , (5000 / 1000) // , 30 // , listener// ); } default: break; } } }); break; } default: break; } }
From source file:android.percent.support.PercentLayoutHelper.java
/** * Iterates over children and changes their width and height to one calculated from percentage * values./*from ww w . j av a2s .c o m*/ * * @param widthMeasureSpec Width MeasureSpec of the parent ViewGroup. * @param heightMeasureSpec Height MeasureSpec of the parent ViewGroup. */ public void adjustChildren(int widthMeasureSpec, int heightMeasureSpec) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "adjustChildren: " + mHost + " widthMeasureSpec: " + View.MeasureSpec.toString(widthMeasureSpec) + " heightMeasureSpec: " + View.MeasureSpec.toString(heightMeasureSpec)); } int widthHint = View.MeasureSpec.getSize(widthMeasureSpec); int heightHint = View.MeasureSpec.getSize(heightMeasureSpec); if (Log.isLoggable(TAG, Log.DEBUG)) Log.d(TAG, "widthHint = " + widthHint + " , heightHint = " + heightHint); for (int i = 0, N = mHost.getChildCount(); i < N; i++) { View view = mHost.getChildAt(i); ViewGroup.LayoutParams params = view.getLayoutParams(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "should adjust " + view + " " + params); } if (params instanceof PercentLayoutParams) { PercentLayoutInfo info = ((PercentLayoutParams) params).getPercentLayoutInfo(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "using " + info); } if (info != null) { supportTextSize(widthHint, heightHint, view, info); supportPadding(widthHint, heightHint, view, info); supportMinOrMaxDimesion(widthHint, heightHint, view, info); if (params instanceof ViewGroup.MarginLayoutParams) { info.fillMarginLayoutParams((ViewGroup.MarginLayoutParams) params, widthHint, heightHint); } else { info.fillLayoutParams(params, widthHint, heightHint); } } } } }
From source file:com.android.car.trust.CarBleTrustAgent.java
@Override public void onDestroy() { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Car Trust agent shutting down"); }//from w w w . ja v a 2s . c o m mLocalBroadcastManager.unregisterReceiver(mTrustEventReceiver); // Unbind the service to avoid leaks from BLE stack. if (mBleServiceBound) { unbindService(mServiceConnection); } super.onDestroy(); }
From source file:com.abajeli.wearable.gesturecadabra.MainActivity.java
/** * This will save battery/*from w w w . j ava2s. c o m*/ */ @Override protected void onPause() { super.onPause(); mSensorManager.unregisterListener(this); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Unregistered for sensor events"); } }
From source file:com.yxkang.android.percent.PercentLayoutHelper.java
/** * Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from * {@code LayoutParams(Context c, AttributeSet attrs)} constructor. * * @param context Context/*from w ww . ja va2s.co m*/ * @param attrs AttributeSet * @return PercentLayoutInfo */ public static PercentLayoutInfo getPercentLayoutInfo(Context context, AttributeSet attrs) { PercentLayoutInfo info = null; TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.PercentLayout_Layout); float value = array.getFraction(R.styleable.PercentLayout_Layout_layout_widthPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent width: " + value); } info = new PercentLayoutInfo(); info.widthPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_heightPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent height: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.heightPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.leftMarginPercent = value; info.topMarginPercent = value; info.rightMarginPercent = value; info.bottomMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginLeftPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent left margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.leftMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginTopPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent top margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.topMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginRightPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent right margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.rightMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginBottomPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent bottom margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.bottomMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginStartPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent start margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.startMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_marginEndPercent, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "percent end margin: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.endMarginPercent = value; } value = array.getFraction(R.styleable.PercentLayout_Layout_layout_aspectRatio, 1, 1, -1f); if (value != -1f) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "aspect ratio: " + value); } info = info != null ? info : new PercentLayoutInfo(); info.aspectRatio = value; } array.recycle(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "constructed: " + info); } return info; }
From source file:edu.berkeley.boinc.client.NoticeNotification.java
private static final Bitmap getLargeProjectIcon(final Context context, final String projectName) { final Bitmap projectIconBitmap; try {/* w w w . j a va 2s . c o m*/ return (projectIconBitmap = Monitor.getClientStatus().getProjectIconByName(projectName)) != null ? Bitmap.createScaledBitmap(projectIconBitmap, projectIconBitmap.getWidth() << 1, projectIconBitmap.getHeight() << 1, false) : BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_stat_notify_boinc_normal); } catch (Exception e) { if (Log.isLoggable(Logging.TAG, Log.DEBUG)) { Log.d(Logging.TAG, e.getLocalizedMessage(), e); } return BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_stat_notify_boinc_normal); } }
From source file:com.tct.fw.ex.photo.adapters.BaseCursorPagerAdapter.java
/** * Swap in a new Cursor, returning the old Cursor. * * @param newCursor The new cursor to be used. * @return Returns the previously set Cursor, or null if there was not one. * If the given new Cursor is the same instance is the previously set * Cursor, null is also returned./*w ww .jav a 2 s . com*/ */ public Cursor swapCursor(Cursor newCursor) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "swapCursor old=" + (mCursor == null ? -1 : mCursor.getCount()) + "; new=" + (newCursor == null ? -1 : newCursor.getCount())); } if (newCursor == mCursor) { return null; } Cursor oldCursor = mCursor; mCursor = newCursor; if (newCursor != null) { mRowIDColumn = newCursor.getColumnIndex(PhotoContract.PhotoViewColumns.URI); } else { mRowIDColumn = -1; } setItemPosition(); notifyDataSetChanged(); // notify the observers about the new cursor return oldCursor; }
From source file:de.vanita5.twittnuker.util.net.ssl.HostResolvedSSLConnectionSocketFactory.java
@Override public Socket createLayeredSocket(final Socket socket, final String target, final int port, final HttpContext context) throws IOException { final SSLSocket sslsock = (SSLSocket) socketfactory.createSocket(socket, target, port, true); if (supportedProtocols != null) { sslsock.setEnabledProtocols(supportedProtocols); }//from w ww . j a v a 2 s . c o m if (supportedCipherSuites != null) { sslsock.setEnabledCipherSuites(supportedCipherSuites); } prepareSocket(sslsock); // Android specific code to enable SNI if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { if (socketfactory instanceof SSLCertificateSocketFactory) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Enabling SNI for " + target); } ((SSLCertificateSocketFactory) socketfactory).setHostname(sslsock, target); } } // End of Android specific code sslsock.startHandshake(); verifyHostname(sslsock, target, context); return sslsock; }