Java Code Examples for android.util.Log#d()

The following examples show how to use android.util.Log#d() . 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: RootsCache.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
private void handleDocumentsProvider(ProviderInfo info) {
    // Ignore stopped packages for now; we might query them
    // later during UI interaction.
    if ((info.applicationInfo.flags & ApplicationInfo.FLAG_STOPPED) != 0) {
        if (LOGD) Log.d(TAG, "Ignoring stopped authority " + info.authority);
        mTaskStoppedAuthorities.add(info.authority);
        return;
    }

    // Try using cached roots if filtering
    boolean cacheHit = false;
    if (mAuthority != null && !mAuthority.equals(info.authority)) {
        synchronized (mLock) {
            if (mTaskRoots.putAll(info.authority, mRoots.get(info.authority))) {
                if (LOGD) Log.d(TAG, "Used cached roots for " + info.authority);
                cacheHit = true;
            }
        }
    }

    // Cache miss, or loading everything
    if (!cacheHit) {
        mTaskRoots.putAll(info.authority,
                loadRootsForAuthority(mContext.getContentResolver(), info.authority));
    }
}
 
Example 2
Source File: VerticalViewPager.java    From YCScrollPager with Apache License 2.0 6 votes vote down vote up
/**
 * 修改滑动灵敏度
 * @param flingDistance                     滑动惯性,默认是75
 * @param minimumVelocity                   最小滑动值,默认是1200
 */
public void setScrollFling(int flingDistance , int minimumVelocity){
    try {
        Field mFlingDistance = ViewPager.class.getDeclaredField("mFlingDistance");
        mFlingDistance.setAccessible(true);
        Object o = mFlingDistance.get(this);
        Log.d("setScrollFling",o.toString());
        //默认值75
        mFlingDistance.set(this, flingDistance);

        Field mMinimumVelocity = ViewPager.class.getDeclaredField("mMinimumVelocity");
        mMinimumVelocity.setAccessible(true);
        Object o1 = mMinimumVelocity.get(this);
        Log.d("setScrollFling",o1.toString());
        //默认值1200
        mMinimumVelocity.set(this,minimumVelocity);
    } catch (Exception e){
        e.printStackTrace();
    }
}
 
Example 3
Source File: PurchaseWemovecoinsActivity.java    From guarda-android-wallets with GNU General Public License v3.0 6 votes vote down vote up
private void getBtcAddress(final String walletNum) {
    Log.d("flint", "PurchaseWemovecoinsActivity.getBtcAddress()...");
    showProgress();
    String code = "btc";
    ChangellyNetworkManager.generateAddress(code.toLowerCase(), MAIN_CURRENCY, walletNum, null, new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            ResponseGenerateAddress addressItem = (ResponseGenerateAddress) response;
            if (addressItem.getAddress() != null && addressItem.getAddress().getAddress() != null) {
                closeProgress();
                onAddressGenerated(addressItem.getAddress().getAddress());
            } else {
                getBtcAddress_changenow(walletNum);
            }
        }

        @Override
        public void onFailure(String msg) {
            getBtcAddress_changenow(walletNum);
        }
    });
}
 
Example 4
Source File: ResultHandler.java    From weex with Apache License 2.0 5 votes vote down vote up
/**
 * Like {@link #launchIntent(Intent)} but will tell you if it is not handle-able
 * via {@link ActivityNotFoundException}.
 *
 * @throws ActivityNotFoundException
 */
final void rawLaunchIntent(Intent intent) {
  if (intent != null) {
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    Log.d(TAG, "Launching intent: " + intent + " with extras: " + intent.getExtras());
    activity.startActivity(intent);
  }
}
 
Example 5
Source File: CameraSourcePreview.java    From Machine-Learning-Projects-for-Mobile-Applications with MIT License 5 votes vote down vote up
public void stop() {
    Log.d(TAG,"Inside Stop");
    mStartRequested = false;
    if(usingCameraOne) {
        if (mCameraSource != null) {
            mCameraSource.stop();
        }
    } else {
        if(mCamera2Source != null) {
            mCamera2Source.stop();
        }
    }
}
 
Example 6
Source File: WatchUpdaterService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
private void sendNotification(String path, String notification) {//KS add args
    forceGoogleApiConnect();
    if (googleApiClient.isConnected()) {
        Log.d(TAG, "sendNotification Notification=" + notification + " Path=" + path);
        PutDataMapRequest dataMapRequest = PutDataMapRequest.create(path);
        //unique content
        dataMapRequest.setUrgent();
        dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
        dataMapRequest.getDataMap().putString(notification, notification);
        PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
        Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
    } else {
        Log.e(TAG, "sendNotification No connection to wearable available!");
    }
}
 
Example 7
Source File: ServiceSinkhole.java    From tracker-control-android with GNU General Public License v3.0 5 votes vote down vote up
private void stop(boolean temporary) {
    if (vpn != null) {
        stopNative(vpn);
        stopVPN(vpn);
        vpn = null;
        unprepare();
    }
    if (state == State.enforcing && !temporary) {
        Log.d(TAG, "Stop foreground state=" + state.toString());
        last_allowed = -1;
        last_blocked = -1;
        last_hosts = -1;

        stopForeground(true);

        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSinkhole.this);
        if (prefs.getBoolean("show_stats", false)) {
            startForeground(NOTIFY_WAITING, getWaitingNotification());
            state = State.waiting;
            Log.d(TAG, "Start foreground state=" + state.toString());
        } else {
            state = State.none;

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                stopForeground(true);
            } else {
                stopSelf();
            }
        }
    }
}
 
Example 8
Source File: ProxyCameraActivity.java    From DocUIProxy-Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Prevent invalid actions
    final Intent intent = getIntent();
    if (intent == null || intent.getAction() == null) {
        Log.e(TAG, "Invalid intent. Activity will exit now.");
        finish();
        return;
    }

    if (!MediaStore.ACTION_IMAGE_CAPTURE.equals(intent.getAction())) {
        Log.e(TAG, "ProxyCameraActivity can receive Media.ACTION_IMAGE_CAPTURE only. " +
                "But its action is " + intent.getAction());
        finish();
        return;
    }

    // Get extras from current capture intent
    getExtrasFromCaptureIntent(intent);

    // Start process
    shouldBeHandled = Settings.isSourceAppShouldBeHandled(getReferrerPackage());
    if (shouldBeHandled) {
        Log.d(TAG, "Receive an valid capture intent from WeChat. " +
                "Now we start process it.");
        processIntentForWeChat(intent);
    } else {
        Log.v(TAG, "Receive an valid capture intent from other apps. " +
                "We should open a preferred camera application or start chooser.");
        processIntentForOthers(intent);
    }
}
 
Example 9
Source File: StickyNavLayout.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    final ViewGroup.LayoutParams params = mTop.getLayoutParams();
    Log.d(TAG, "onSizeChanged-mTopViewHeight:" + mTopViewHeight);
    mTop.post(new Runnable() {
        @Override
        public void run() {
            if (mTop instanceof ViewGroup) {
                ViewGroup viewGroup = (ViewGroup) mTop;
                int height = viewGroup.getChildAt(0).getHeight();
                mTopViewHeight = height - stickOffset;
                params.height = height;
                mTop.setLayoutParams(params);
                mTop.requestLayout();
            } else {
                mTopViewHeight = mTop.getMeasuredHeight() - stickOffset;
            }
            Log.d(TAG, "mTopViewHeight:" + mTopViewHeight);
            if (null != mInnerScrollView) {
                Log.d(TAG, "mInnerScrollViewHeight:" + mInnerScrollView.getMeasuredHeight());
            }
            if (isStickNav) {
                scrollTo(0, mTopViewHeight);
            }
        }
    });
}
 
Example 10
Source File: Update2Helper.java    From NovelReader with MIT License 5 votes vote down vote up
/**
 * 存储新的数据库表 以及数据
 *
 * @param db
 */
private void restoreData(Database db,Class<? extends AbstractDao<?, ?>> bookChapterClass) {
    DaoConfig daoConfig = new DaoConfig(db, bookChapterClass);
    String tableName = daoConfig.tablename;
    String tempTableName = daoConfig.tablename.concat("_TEMP");
    ArrayList<String> properties = new ArrayList();

    for (int j = 0; j < daoConfig.properties.length; j++) {
        String columnName = daoConfig.properties[j].columnName;
        if (getColumns(db, tableName).contains(columnName)) {
            properties.add(columnName);
        }
    }

    StringBuilder insertTableStringBuilder = new StringBuilder();

    insertTableStringBuilder.append("INSERT INTO ").append(tableName).append(" (");
    insertTableStringBuilder.append(TextUtils.join(",", properties));
    insertTableStringBuilder.append(") SELECT ");
    insertTableStringBuilder.append(TextUtils.join(",", properties));
    insertTableStringBuilder.append(" FROM ").append(tempTableName).append(";");

    Log.d(TAG, "restoreData: " + insertTableStringBuilder.toString());

    StringBuilder dropTableStringBuilder = new StringBuilder();
    dropTableStringBuilder.append("DROP TABLE ").append(tempTableName);
    db.execSQL(insertTableStringBuilder.toString());
    db.execSQL(dropTableStringBuilder.toString());
}
 
Example 11
Source File: OAuthManagerFragmentController.java    From react-native-oauth with MIT License 5 votes vote down vote up
public void onComplete(String url) {
  Log.d(TAG, "onComplete called in fragment controller " + url);
  // if (mWebView != null) {
  //   this.getAccessToken(mWebView, url);
  // } else {
    // this.dismissDialog();
  // }
}
 
Example 12
Source File: ImageViewTouchBase.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
protected void _setImageDrawable(final Drawable drawable, final Matrix initial_matrix, float min_zoom, float max_zoom ) {

		if ( LOG_ENABLED ) {
			Log.i( LOG_TAG, "_setImageDrawable" );
		}

		if ( drawable != null ) {

			if ( LOG_ENABLED ) {
				Log.d( LOG_TAG, "size: " + drawable.getIntrinsicWidth() + "x" + drawable.getIntrinsicHeight() );
			}
			super.setImageDrawable( drawable );
		} else {
			mBaseMatrix.reset();
			super.setImageDrawable( null );
		}

		if ( min_zoom != ZOOM_INVALID && max_zoom != ZOOM_INVALID ) {
			min_zoom = Math.min( min_zoom, max_zoom );
			max_zoom = Math.max( min_zoom, max_zoom );

			mMinZoom = min_zoom;
			mMaxZoom = max_zoom;

			mMinZoomDefined = true;
			mMaxZoomDefined = true;

			if ( mScaleType == DisplayType.FIT_TO_SCREEN || mScaleType == DisplayType.FIT_IF_BIGGER ) {

				if ( mMinZoom >= 1 ) {
					mMinZoomDefined = false;
					mMinZoom = ZOOM_INVALID;
				}

				if ( mMaxZoom <= 1 ) {
					mMaxZoomDefined = true;
					mMaxZoom = ZOOM_INVALID;
				}
			}
		} else {
			mMinZoom = ZOOM_INVALID;
			mMaxZoom = ZOOM_INVALID;

			mMinZoomDefined = false;
			mMaxZoomDefined = false;
		}

		if ( initial_matrix != null ) {
			mNextMatrix = new Matrix( initial_matrix );
		}

		mBitmapChanged = true;
		requestLayout();
	}
 
Example 13
Source File: DebugService.java    From input-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onFillRequest(FillRequest request, CancellationSignal cancellationSignal,
        FillCallback callback) {
    Log.d(TAG, "onFillRequest()");

    // Find autofillable fields
    AssistStructure structure = getLatestAssistStructure(request);
    ArrayMap<String, AutofillId> fields = getAutofillableFields(structure);
    Log.d(TAG, "autofillable fields:" + fields);

    if (fields.isEmpty()) {
        toast("No autofill hints found");
        callback.onSuccess(null);
        return;
    }

    // Create response...
    FillResponse response;
    if (mAuthenticateResponses) {
        int size = fields.size();
        String[] hints = new String[size];
        AutofillId[] ids = new AutofillId[size];
        for (int i = 0; i < size; i++) {
            hints[i] = fields.keyAt(i);
            ids[i] = fields.valueAt(i);
        }

        IntentSender authentication = SimpleAuthActivity.newIntentSenderForResponse(this, hints,
                ids, mAuthenticateDatasets);
        RemoteViews presentation = newDatasetPresentation(getPackageName(),
                    "Tap to auth response");

        response = new FillResponse.Builder()
                .setAuthentication(ids, authentication, presentation).build();
    } else {
        response = createResponse(this, fields, mNumberDatasets,mAuthenticateDatasets);
    }

    // ... and return it
    callback.onSuccess(response);
}
 
Example 14
Source File: Logger.java    From Fatigue-Detection with MIT License 4 votes vote down vote up
public static long logPassedTime(String name){
    long ret=System.currentTimeMillis()-currentTime;
    Log.d(TAG, name+" is finished, timePassed: "+ret);
    return ret;
}
 
Example 15
Source File: MainActivity.java    From Reactive-Android-Programming with MIT License 4 votes vote down vote up
private void log(String stage) {
    Log.d("APP", stage + ":" + Thread.currentThread().getName());
}
 
Example 16
Source File: ProvisionLogger.java    From island with Apache License 2.0 4 votes vote down vote up
/**
 * Log the message at DEBUG level.
 */
public static void logd(String message, Throwable t) {
    if (LOG_ENABLED) {
        Log.d(getTag(), message, t);
    }
}
 
Example 17
Source File: ImageHeaderParser.java    From styT with Apache License 2.0 4 votes vote down vote up
private byte[] getExifSegment() throws IOException {
    short segmentId, segmentType;
    int segmentLength;
    while (true) {
        segmentId = streamReader.getUInt8();

        if (segmentId != SEGMENT_START_ID) {
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Unknown segmentId=" + segmentId);
            }
            return null;
        }

        segmentType = streamReader.getUInt8();

        if (segmentType == SEGMENT_SOS) {
            return null;
        } else if (segmentType == MARKER_EOI) {
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "Found MARKER_EOI in exif segment");
            }
            return null;
        }

        // Segment length includes bytes for segment length.
        segmentLength = streamReader.getUInt16() - 2;

        if (segmentType != EXIF_SEGMENT_TYPE) {
            long skipped = streamReader.skip(segmentLength);
            if (skipped != segmentLength) {
                if (Log.isLoggable(TAG, Log.DEBUG)) {
                    Log.d(TAG, "Unable to skip enough data"
                        + ", type: " + segmentType
                        + ", wanted to skip: " + segmentLength
                        + ", but actually skipped: " + skipped);
                }
                return null;
            }
        } else {
            byte[] segmentData = new byte[segmentLength];
            int read = streamReader.read(segmentData);
            if (read != segmentLength) {
                if (Log.isLoggable(TAG, Log.DEBUG)) {
                    Log.d(TAG, "Unable to read segment data"
                        + ", type: " + segmentType
                        + ", length: " + segmentLength
                        + ", actually read: " + read);
                }
                return null;
            } else {
                return segmentData;
            }
        }
    }
}
 
Example 18
Source File: DefaultLogger.java    From Study_Android_Demo with Apache License 2.0 4 votes vote down vote up
public static void monitor(String message) {
    if (isShowLog && isMonitorMode()) {
        StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[3];
        Log.d(TAG + "::monitor", message + getExtInfo(stackTraceElement));
    }
}
 
Example 19
Source File: Logger.java    From rosetta with MIT License 4 votes vote down vote up
void debug(String log) {
    Log.d(this.mTag, log);
}
 
Example 20
Source File: KeyValueStorage.java    From GodotSQL with Apache License 2.0 3 votes vote down vote up
public static void setNonEncryptedKeyValue(String key, String val) {
	Log.d(TAG, "Setting " + val + " for key: " + key);

	if (val.equals("false")) { val = "0"; }
	else if  (val.equals("true")) { val = "1"; }

	val = getAESObfuscator().obfuscateString(val);

	getDatabase().setKeyVal(key, val);
}