Java Code Examples for timber.log.Timber#w()
The following examples show how to use
timber.log.Timber#w() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DebugView.java From debugdrawer with Apache License 2.0 | 7 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) private static void enableLayoutTransitions(ViewGroup viewGroup) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { // Remove the status bar color. The DrawerLayout is responsible for drawing it from now on. LayoutTransition lt = new LayoutTransition(); lt.enableTransitionType(LayoutTransition.CHANGING); viewGroup.setLayoutTransition(lt); } else { Timber.w("Error enabling LayoutTransitions, only supported for API14+."); } }
Example 2
Source File: KeyStoreHelper.java From xmrwallet with Apache License 2.0 | 6 votes |
private static PrivateKey getPrivateKey(String alias) { try { KeyStore ks = KeyStore .getInstance(SecurityConstants.KEYSTORE_PROVIDER_ANDROID_KEYSTORE); ks.load(null); //KeyStore.Entry entry = ks.getEntry(alias, null); PrivateKey privateKey = (PrivateKey) ks.getKey(alias, null); if (privateKey == null) { Timber.w("No key found under alias: %s", alias); return null; } return privateKey; } catch (IOException | NoSuchAlgorithmException | CertificateException | UnrecoverableEntryException | KeyStoreException ex) { throw new IllegalStateException(ex); } }
Example 3
Source File: CreateBondTransaction.java From bitgatt with Mozilla Public License 2.0 | 6 votes |
private void createBond(Context context) { FitbitBluetoothDevice device = getDevice(); if (device == null) { Timber.w("[%s] Couldn't create the bond because device was null", device); bondFailure(); } else { createBond(context, device); // let's go ahead and wait until the bond timeout synchronized (NAME) { try { NAME.wait(BOND_TIMEOUT); } catch (InterruptedException e) { Timber.e(e, "[%s] Well, the thread was interrupted, we will just let it go", device); } } } }
Example 4
Source File: MainActivity.java From TowerCollector with Mozilla Public License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.M) private void startBatteryOptimizationsSystemActivity() { try { Intent intent = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS); startActivityForResult(intent, BATTERY_OPTIMIZATIONS_ACTIVITY_RESULT); } catch (ActivityNotFoundException ex) { Timber.w(ex, "startBatteryOptimizationsSystemActivity(): Could not open Settings to change battery optimizations"); MyApplication.handleSilentException(ex); showCannotOpenAndroidSettingsDialog(); } }
Example 5
Source File: GattClientDiscoverServicesTransaction.java From bitgatt with Mozilla Public License 2.0 | 5 votes |
@Override protected void transaction(GattTransactionCallback callback) { super.transaction(callback); getConnection().setState(GattState.DISCOVERING); boolean success; BluetoothGatt localGatt = getConnection().getGatt(); if(localGatt == null) { Timber.w("The gatt was null during discovery, are you sure the connection wasn't cancelled? Please make sure to handle the transaction results."); success = false; } else { success = localGatt.discoverServices(); } if(!success) { getConnection().setState(GattState.DISCOVERY_FAILURE); TransactionResult.Builder builder = new TransactionResult.Builder(); builder.gattState(getConnection().getGattState()) .resultStatus(TransactionResult.TransactionResultStatus.FAILURE); mainThreadHandler.post(() -> { callCallbackWithTransactionResultAndRelease(callback, builder.build()); getConnection().setState(GattState.IDLE); }); } else { synchronized (NAME) { try { NAME.wait(DEFAULT_GATT_TRANSACTION_TIMEOUT); } catch (InterruptedException e) { Timber.e(e, "[%s] Not the end of the world, we'll just let it go", getDevice()); } } } }
Example 6
Source File: ActivityLifecycle.java From MVVMArms with Apache License 2.0 | 5 votes |
@Override public void onActivityCreated(Activity activity, Bundle savedInstanceState) { Timber.w("%s ---> onActivityCreated", activity); //如果 intent 包含了此字段,并且为 true 说明不加入到 list 进行统一管理 boolean isNotAdd = false; if (activity.getIntent() != null) { isNotAdd = activity.getIntent().getBooleanExtra(AppManager.IS_NOT_ADD_ACTIVITY_LIST, false); } if (!isNotAdd) { mAppManager.addActivity(activity); } //配置ActivityDelegate if (activity instanceof IActivity && activity.getIntent() != null) { ActivityDelegate activityDelegate = fetchActivityDelegate(activity); if (activityDelegate == null) { activityDelegate = new ActivityDelegateImpl(activity); activity.getIntent().putExtra(ActivityDelegate.ACTIVITY_DELEGATE, activityDelegate); } activityDelegate.onCreate(savedInstanceState); } // 给每个Activity配置Fragment的监听,Activity可以通过 {@link IActivity#useFragment()} 设置是否使用监听 registerFragmentCallbacks(activity); }
Example 7
Source File: NavigationEventDispatcher.java From graphhopper-navigation-android with MIT License | 5 votes |
void removeProgressChangeListener(@Nullable ProgressChangeListener progressChangeListener) { if (progressChangeListener == null) { progressChangeListeners.clear(); } else if (!progressChangeListeners.contains(progressChangeListener)) { Timber.w("The specified ProgressChangeListener isn't found in stack, therefore, cannot be removed."); } else { progressChangeListeners.remove(progressChangeListener); } }
Example 8
Source File: PlayerFragment.java From Sky31Radio with Apache License 2.0 | 5 votes |
@Override public void onServiceDisconnected(ComponentName name) { Timber.w("onServiceDisconnected"); this.service = null; handler.removeMessages(MSG_UPDATE); equalizerView.release(); disablePlayerBar(); playPauseButton.setEnabled(false); }
Example 9
Source File: FitbitGatt.java From bitgatt with Mozilla Public License 2.0 | 5 votes |
/** * Will add a device that was discovered via the background scan in a provided scan result to * the connected devices map and will notify listeners of the availability of the new connection. This will allow * an API user to add devices from scans that occur outside of the context of the periodical scanner. * * @param device The scan result from the background system scan */ synchronized void addBackgroundScannedDeviceConnection(@Nullable FitbitBluetoothDevice device) { if (device != null) { device.origin = FitbitBluetoothDevice.DeviceOrigin.SCANNED; addScannedDevice(device); } else { Timber.w("No result provided."); } }
Example 10
Source File: FragmentLifecycle.java From Aurora with Apache License 2.0 | 5 votes |
@Override public void onFragmentStopped(FragmentManager fm, Fragment f) { Timber.w(f.toString() + " - onFragmentStopped"); FragmentDelegate fragmentDelegate = fetchFragmentDelegate(f); if (fragmentDelegate != null) { fragmentDelegate.onStop(); } }
Example 11
Source File: BluetoothIhealthHS3.java From openScale with GNU General Public License v3.0 | 5 votes |
private boolean sendBtData(String data) { Timber.w("ihealthHS3 - sendBtData %s", data); if (btSocket.isConnected()) { btConnectThread = new BluetoothConnectedThread(); btConnectThread.write(data.getBytes()); btConnectThread.cancel(); return true; } Timber.w("ihealthHS3 - sendBtData - socket is not connected"); return false; }
Example 12
Source File: FitbitGatt.java From bitgatt with Mozilla Public License 2.0 | 5 votes |
/** * Will put the scanner into mock mode which is useful for testing * * @param mockMode true to set mock mode, false to disable it. */ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @SuppressWarnings({"unused", "WeakerAccess"}) // API Method public void setScannerMockMode(boolean mockMode) { if (peripheralScanner == null) { Timber.w("You are trying to put the scanner into mock mode, but the scanner isn't set-up, did you call FitbitGatt#initializeScanner?"); return; } alwaysConnectedScanner.setTestMode(mockMode); }
Example 13
Source File: FitbitGatt.java From bitgatt with Mozilla Public License 2.0 | 5 votes |
/** * Will cancel high priority and periodical scans that are currently running, but will not have any effect if using the * background PendingIntent based scanner, and will not un-schedule periodical scans. Use {@link PeripheralScanner#cancelPeriodicalScan(Context)} * to stop periodical scans. * * @param context The android context for the scanner */ public void cancelScan(@Nullable Context context) { if (alwaysConnectedScanner.isAlwaysConnectedScannerEnabled()) { Timber.i("You are using the always connected scanner, stop it first before ad-hoc scanning"); return; } if (peripheralScanner == null) { Timber.w("You are trying to cancel a scan, but the scanner isn't set-up, did you call FitbitGatt#initializeScanner?"); return; } peripheralScanner.cancelScan(context); }
Example 14
Source File: ExchangeEditText.java From xmrwallet with Apache License 2.0 | 5 votes |
private void exchange(double rate) { double amount = getEnteredAmount(); if (rate > 0) { tvAmountB.setText(Helper.getFormattedAmount(rate * amount, getCurrencyB() == 0)); } else { tvAmountB.setText(null); Timber.w("No rate!"); } }
Example 15
Source File: API29MigrationService.java From Hentoid with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); notificationManager = new ServiceNotificationManager(this, NOTIFICATION_ID); notificationManager.cancel(); notificationManager.startForeground(new ImportStartNotification()); Timber.w("Service created"); }
Example 16
Source File: GlideImageLoaderStrategy.java From Aurora with Apache License 2.0 | 4 votes |
@Override public void applyGlideOptions(Context context, GlideBuilder builder) { Timber.w("applyGlideOptions"); }
Example 17
Source File: SendGattServerResponseTransaction.java From bitgatt with Mozilla Public License 2.0 | 4 votes |
@Override protected void transaction(GattTransactionCallback callback) { super.transaction(callback); getGattServer().setState(GattState.SENDING_SERVER_RESPONSE); TransactionResult.Builder builder = new TransactionResult.Builder().transactionName(getName()); boolean success; try { success = getGattServer().getServer().sendResponse(device.getBtDevice(), requestId, status, offset, value); } catch (NullPointerException ex) { Timber.w(ex,"[%s] We are going to fail this tx due to the stack NPE, this is probably poor peripheral behavior, this should become a FW bug.", getDevice()); success = false; } if (success) { getGattServer().setState(GattState.SEND_SERVER_RESPONSE_SUCCESS); builder.gattState(getGattServer().getGattState()); builder.resultStatus(TransactionResult.TransactionResultStatus.SUCCESS); builder.responseStatus(GattStatus.getStatusForCode(status).ordinal()); builder.data(value). requestId(requestId). offset(offset); mainThreadHandler.post(() -> { callCallbackWithTransactionResultAndRelease(callback, builder.build()); getGattServer().setState(GattState.IDLE); }); } else { getGattServer().setState(GattState.SEND_SERVER_RESPONSE_FAILURE); builder.gattState(getGattServer().getGattState()); builder.resultStatus(TransactionResult.TransactionResultStatus.FAILURE); builder.responseStatus(GattStatus.getStatusForCode(status).ordinal()); builder.data(value). requestId(requestId). offset(offset); mainThreadHandler.post(() -> { callCallbackWithTransactionResultAndRelease(callback, builder.build()); getGattServer().setState(GattState.IDLE); // we want to apply this strategy to every phone, so we will provide an empty target android // device Strategy strategy = strategyProvider. getStrategyForPhoneAndGattConnection(null, getConnection(), Situation.TRACKER_WENT_AWAY_DURING_GATT_OPERATION); if(strategy != null) { strategy.applyStrategy(); } }); } }
Example 18
Source File: GattTransaction.java From bitgatt with Mozilla Public License 2.0 | 4 votes |
private ParentGattTransactionCallback getGattTransactionCallback(GattTransaction tx, GattTransactionCallback wrappedCallback) { return new ParentGattTransactionCallback() { @Override public void onTransactionComplete(@NonNull TransactionResult result) { int done = executedTransactions.addAndGet(1); int totalTx = preCommitHooks.size() + postCommitHooks.size() + 1; // the 1 is this if (FitbitGatt.getInstance().isSlowLoggingEnabled()) { Timber.v("[%s] Transaction %s complete.", getDevice(), tx.getName()); Timber.v("[%s] Transactions done %d of %d", getDevice(), done, totalTx); } if (!result.resultStatus.equals(TransactionResult.TransactionResultStatus.SUCCESS)) { Timber.w("[%s] The transaction %s failed, Result: %s", getDevice(), tx.getName(), result); wrappedCallback.onTransactionComplete(result); unregisterListener(tx); Timber.w("[%s] Halting the execution chain because tx %s failed", getDevice(), tx.getName()); GattTransaction.this.haltChain = true; // we will dispose of all timeouts now because none of the other runnables // will complete timeoutHandler.removeCallbacksAndMessages(null); } else { if (FitbitGatt.getInstance().isSlowLoggingEnabled()) { Timber.d("[%s] Transaction %s success, Result: %s", getDevice(), tx.getName(), result); } // the callbacks are always handled by the individual transactions, here we only // want to manage the timeout if (done == totalTx) { // we only want to remove the timeout once the final tx completes timeoutHandler.removeCallbacksAndMessages(null); // only callback here if there is only a single transaction, otherwise // let the internal callbacks handle it if (totalTx == 1) { wrappedCallback.onTransactionComplete(result); release(); } } else if (FitbitGatt.getInstance().isSlowLoggingEnabled()) { Timber.v("[%s] Pre / Post commit tx : %s completed successfully", getDevice(), tx.getName()); } unregisterListener(tx); } } }; }
Example 19
Source File: BrowserServicePackageValidator.java From Jockey with Apache License 2.0 | 4 votes |
/** * @return false if the caller is not authorized to get data from this MediaBrowserService */ @SuppressLint("BinaryOperationInTimber") @SuppressWarnings("BooleanMethodIsAlwaysInverted") public boolean isCallerAllowed(Context context, String callingPackage, int callingUid) { // Always allow calls from the framework, self app or development environment. if (Process.SYSTEM_UID == callingUid || Process.myUid() == callingUid) { return true; } if (isPlatformSigned(context, callingPackage)) { return true; } PackageInfo packageInfo = getPackageInfo(context, callingPackage); if (packageInfo == null) { return false; } if (packageInfo.signatures.length != 1) { Timber.w("Caller does not have exactly one signature certificate!"); return false; } String signature = Base64.encodeToString( packageInfo.signatures[0].toByteArray(), Base64.NO_WRAP); // Test for known signatures: ArrayList<CallerInfo> validCallers = mValidCertificates.get(signature); if (validCallers == null) { Timber.v("Signature for caller %s is not valid: \n%s", callingPackage, signature); if (mValidCertificates.isEmpty()) { Timber.w("The list of valid certificates is empty. Either your file " + "res/xml/allowed_media_browser_callers.xml is empty or there was an error " + "while reading it. Check previous log messages."); } return false; } // Check if the package name is valid for the certificate: StringBuilder expectedPackages = new StringBuilder(); for (CallerInfo info: validCallers) { if (callingPackage.equals(info.packageName)) { Timber.v("Valid caller: %s package= %s release=%s", info.name, info.packageName, info.release); return true; } expectedPackages.append(info.packageName).append(' '); } Timber.i("Caller has a valid certificate, but its package doesn't match any " + "expected package for the given certificate. Caller's package is " + callingPackage + ". Expected packages as defined in res/xml/allowed_media_browser_callers.xml are (" + expectedPackages + "). This caller's certificate is: \n" + signature); return false; }
Example 20
Source File: ContentItem.java From Hentoid with Apache License 2.0 | 4 votes |
private void attachCover(@NonNull final Content content) { String thumbLocation = content.getCover().getFileUri(); if (thumbLocation.isEmpty()) thumbLocation = content.getCover().getUrl(); if (thumbLocation.isEmpty()) thumbLocation = content.getCoverImageUrl(); // Use content's cookies to load image (useful for ExHentai when viewing queue screen) if (thumbLocation.startsWith("http") && content.getDownloadParams() != null && content.getDownloadParams().length() > 2 // Avoid empty and "{}" && content.getDownloadParams().contains(HttpHelper.HEADER_COOKIE_KEY)) { Map<String, String> downloadParams = null; try { downloadParams = JsonHelper.jsonToObject(content.getDownloadParams(), JsonHelper.MAP_STRINGS); } catch (IOException e) { Timber.w(e); } if (downloadParams != null && downloadParams.containsKey(HttpHelper.HEADER_COOKIE_KEY)) { String cookiesStr = downloadParams.get(HttpHelper.HEADER_COOKIE_KEY); if (cookiesStr != null) { LazyHeaders.Builder builder = new LazyHeaders.Builder() .addHeader(HttpHelper.HEADER_COOKIE_KEY, cookiesStr); GlideUrl glideUrl = new GlideUrl(thumbLocation, builder.build()); Glide.with(ivCover) .load(glideUrl) .apply(glideRequestOptions) .into(ivCover); return; } } } if (thumbLocation.startsWith("http")) Glide.with(ivCover) .load(thumbLocation) .apply(glideRequestOptions) .into(ivCover); else Glide.with(ivCover) .load(Uri.parse(thumbLocation)) .apply(glideRequestOptions) .into(ivCover); }