Example usage for android.util Log DEBUG

List of usage examples for android.util Log DEBUG

Introduction

In this page you can find the example usage for android.util Log DEBUG.

Prototype

int DEBUG

To view the source code for android.util Log DEBUG.

Click Source Link

Document

Priority constant for the println method; use Log.d.

Usage

From source file:com.sleekcoder.weardemo.NotificationUpdateService.java

@Override
public void onDataChanged(DataEventBuffer dataEvents) {
    final List<DataEvent> events = FreezableUtils.freezeIterable(dataEvents);
    dataEvents.close();/*from  w ww . j a  v  a2s  .c  o  m*/

    for (DataEvent dataEvent : events) {
        if (dataEvent.getType() == DataEvent.TYPE_CHANGED
                && dataEvent.getDataItem().getUri().getPath().equals(Constants.IMAGE_PATH)) {
            DataMapItem dataMapItem = DataMapItem.fromDataItem(dataEvent.getDataItem());
            Asset image = dataMapItem.getDataMap().getAsset("image");
            Bitmap bitmap = loadBitMapFromAsset(image);
            buildWearableOnlyNotification("Image", "You took a photo!", Constants.BOTH_ID, false, bitmap);
        } else if (dataEvent.getType() == DataEvent.TYPE_CHANGED) {
            DataMap dataMap = DataMapItem.fromDataItem(dataEvent.getDataItem()).getDataMap();
            String content = dataMap.getString(Constants.KEY_CONTENT);
            String title = dataMap.getString(Constants.KEY_TITLE);
            if (Constants.WATCH_ONLY_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
                buildWearableOnlyNotification(title, content, Constants.WATCH_ONLY_ID, false, null);
            } else if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
                buildWearableOnlyNotification(title, content, Constants.BOTH_ID, true, null);
            }
        } else if (dataEvent.getType() == DataEvent.TYPE_DELETED) {
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "DataItem deleted: " + dataEvent.getDataItem().getUri().getPath());
            }
            if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) {
                ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(Constants.BOTH_ID);
            }
        }
    }
}

From source file:mobi.jzcx.android.core.percent.PercentLayoutHelper.java

/**
 * Iterates over children and changes their width and height to one
 * calculated from percentage values.//from www. j  av  a2 s  . 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);
                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.hitomi.basic.view.percentlayout.PercentLayoutHelper.java

/**
 * Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from
 * {@code LayoutParams(Context c, AttributeSet attrs)} constructor.
 *//*  w w w.  j av a  2s.co m*/
public static PercentLayoutInfo getPercentLayoutInfo(Context context, AttributeSet attrs) {
    PercentLayoutInfo info = null;
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.PercentLayout_Layout);

    info = setWidthAndHeightVal(array, info);
    info = setMarginRelatedVal(array, info);
    info = setPaddingRelatedVal(array, info);
    info = setMinMaxWidthHeightRelatedVal(array, info);
    info = setTextSizeSupportVal(array, info);
    array.recycle();

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "constructed: " + info);
    }
    return info;
}

From source file:com.infine.android.devoxx.ui.SessionsFragment.java

/** {@inheritDoc} */
public void onQueryComplete(int token, Object cookie, Cursor cursor) {
    if (getActivity() == null) {
        return;//from   w  w  w  .  j  ava 2 s . c  o  m
    }

    if (token == SessionsQuery._TOKEN || token == SearchQuery._TOKEN) {
        onSessionOrSearchQueryComplete(cursor);
    } else if (token == TracksQuery._TOKEN) {
        onTrackQueryComplete(cursor);
    } else {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d("SessionsFragment/onQueryComplete", "Query complete, Not Actionable: " + token);
        }
        cursor.close();
    }
}

From source file:com.joptimizer.optimizers.BarrierMethod.java

@Override
public int optimize() throws Exception {
    Log.i(MainActivity.JOPTIMIZER_LOGTAG, "optimize");
    long tStart = System.currentTimeMillis();
    OptimizationResponse response = new OptimizationResponse();

    // @TODO: check assumptions!!!
    //      if(getA()!=null){
    //         if(ALG.rank(getA())>=getA().rows()){
    //            throw new IllegalArgumentException("A-rank must be less than A-rows");
    //         }//from   w ww  . j ava 2  s  .c  om
    //      }

    DoubleMatrix1D X0 = getInitialPoint();
    if (X0 == null) {
        DoubleMatrix1D X0NF = getNotFeasibleInitialPoint();
        if (X0NF != null) {
            double rPriX0NFNorm = Math.sqrt(ALG.norm2(rPri(X0NF)));
            if (rPriX0NFNorm <= getToleranceFeas()
                    && !Double.isNaN(this.barrierFunction.value(X0NF.toArray()))) {
                Log.d(MainActivity.JOPTIMIZER_LOGTAG, "the provided initial point is already feasible");
                X0 = X0NF;
            }
            //            DoubleMatrix1D fiX0NF = getFi(X0NF);
            //            int maxIndex = Utils.getMaxIndex(fiX0NF);
            //            double maxValue = fiX0NF.get(maxIndex);
            //            if (Log.isLoggable(MainActivity.JOPTIMIZER_LOGTAG, Log.DEBUG)) {
            //               Log.d(MainActivity.JOPTIMIZER_LOGTAG,"X0NF  :  " + ArrayUtils.toString(X0NF.toArray()));
            //               Log.d(MainActivity.JOPTIMIZER_LOGTAG,"fiX0NF:  " + ArrayUtils.toString(fiX0NF.toArray()));
            //            }
            //            if(maxValue<0){
            //               //the provided not-feasible starting point is already feasible
            //               Log.d(MainActivity.JOPTIMIZER_LOGTAG,"the provided initial point is already feasible");
            //               X0 = X0NF;
            //            }
        }
        if (X0 == null) {
            BasicPhaseIBM bf1 = new BasicPhaseIBM(this);
            X0 = F1.make(bf1.findFeasibleInitialPoint());
        }
    }

    //check X0 feasibility
    double rPriX0Norm = Math.sqrt(ALG.norm2(rPri(X0)));
    if (Double.isNaN(this.barrierFunction.value(X0.toArray())) || rPriX0Norm > getToleranceFeas()) {
        throw new Exception("initial point must be strictly feasible");
    }
    //      DoubleMatrix1D fiX0 = getFi(X0);
    //      if(fiX0!=null){
    //         int maxIndex = Utils.getMaxIndex(fiX0);
    //         double maxValue = fiX0.get(maxIndex);
    //         if(maxValue >= 0){
    //            Log.d(MainActivity.JOPTIMIZER_LOGTAG,"ineqX0      : " + ArrayUtils.toString(fiX0.toArray()));
    //            Log.d(MainActivity.JOPTIMIZER_LOGTAG,"max ineq index: " + maxIndex);
    //            Log.d(MainActivity.JOPTIMIZER_LOGTAG,"max ineq value: " + maxValue);
    //            throw new Exception("initial point must be strictly feasible");
    //         }
    //      }

    DoubleMatrix1D V0 = (getA() != null) ? F1.make(getA().rows()) : F1.make(0);

    if (Log.isLoggable(MainActivity.JOPTIMIZER_LOGTAG, Log.DEBUG)) {
        Log.d(MainActivity.JOPTIMIZER_LOGTAG, "X0: " + ArrayUtils.toString(X0.toArray()));
        Log.d(MainActivity.JOPTIMIZER_LOGTAG, "V0: " + ArrayUtils.toString(V0.toArray()));
    }

    DoubleMatrix1D X = X0;
    final int dim = X.size();
    double t = 1d;
    int outerIteration = 0;
    while (true) {
        outerIteration++;
        if (Log.isLoggable(MainActivity.JOPTIMIZER_LOGTAG, Log.DEBUG)) {
            Log.d(MainActivity.JOPTIMIZER_LOGTAG, "outerIteration: " + outerIteration);
            Log.d(MainActivity.JOPTIMIZER_LOGTAG, "X=" + ArrayUtils.toString(X.toArray()));
            Log.d(MainActivity.JOPTIMIZER_LOGTAG, "f(X)=" + getF0(X));
        }

        //Stopping criterion: quit if gap < tolerance.
        double gap = this.barrierFunction.getDualityGap(t);
        Log.d(MainActivity.JOPTIMIZER_LOGTAG, "gap: " + gap);
        if (gap <= getTolerance()) {
            break;
        }

        // custom exit condition
        if (checkCustomExitConditions(X)) {
            response.setReturnCode(OptimizationResponse.SUCCESS);
            break;
        }

        //Centering step: compute x*(t) by minimizing tf0 + phi (the barrier function), subject to Ax = b, starting at x.
        final double tIter = t;
        Log.d(MainActivity.JOPTIMIZER_LOGTAG, "t: " + tIter);
        ConvexMultivariateRealFunction newObjectiveFunction = new ConvexMultivariateRealFunction() {

            public double value(double[] X) {
                DoubleMatrix1D x = F1.make(X);
                double phi = barrierFunction.value(X);
                return tIter * getF0(x) + phi;
            }

            public double[] gradient(double[] X) {
                DoubleMatrix1D x = F1.make(X);
                DoubleMatrix1D phiGrad = F1.make(barrierFunction.gradient(X));
                return getGradF0(x).assign(Mult.mult(tIter)).assign(phiGrad, Functions.plus).toArray();
            }

            public double[][] hessian(double[] X) {
                DoubleMatrix1D x = F1.make(X);
                DoubleMatrix2D hessF0X = getHessF0(x);
                double[][] hessX = barrierFunction.hessian(X);
                if (hessX == FunctionsUtils.ZEROES_2D_ARRAY_PLACEHOLDER) {
                    return hessF0X.assign(Mult.mult(tIter)).toArray();
                } else {
                    DoubleMatrix2D phiHess = F2.make(hessX);
                    return hessF0X.assign(Mult.mult(tIter)).assign(phiHess, Functions.plus).toArray();
                }
            }

            public int getDim() {
                return dim;
            }
        };

        //NB: cannot use the same request object for the inner step
        OptimizationRequest or = new OptimizationRequest();
        or.setA((getA() != null) ? getA().toArray() : null);
        or.setAlpha(getAlpha());
        or.setB((getB() != null) ? getB().toArray() : null);
        or.setBeta(getBeta());
        or.setCheckKKTSolutionAccuracy(isCheckKKTSolutionAccuracy());
        or.setCheckProgressConditions(isCheckProgressConditions());
        or.setF0(newObjectiveFunction);
        or.setInitialPoint(X.toArray());
        or.setMaxIteration(getMaxIteration());
        or.setMu(getMu());
        or.setTolerance(getToleranceInnerStep());
        or.setToleranceKKT(getToleranceKKT());

        BarrierNewtonLEConstrainedFSP opt = new BarrierNewtonLEConstrainedFSP(true, this);
        opt.setOptimizationRequest(or);
        if (opt.optimize() == OptimizationResponse.FAILED) {
            response.setReturnCode(OptimizationResponse.FAILED);
            break;
        }
        OptimizationResponse newtonResponse = opt.getOptimizationResponse();

        //Update. x := x*(t).
        X = F1.make(newtonResponse.getSolution());

        //         //Stopping criterion: quit if gap < tolerance.
        //         double gap = this.barrierFunction.getDualityGap(t);
        //         Log.d(MainActivity.JOPTIMIZER_LOGTAG,"gap: "+gap);
        //         if(gap <= getTolerance()){
        //            break;
        //         }
        //         
        //         // custom exit condition
        //         if(checkCustomExitConditions(X)){
        //            response.setReturnCode(OptimizationResponse.SUCCESS);
        //            break;
        //         }

        //Increase t: t := mu*t.
        t = getMu() * t;

        // iteration limit condition
        if (outerIteration == getMaxIteration()) {
            response.setReturnCode(OptimizationResponse.WARN);
            Log.w(MainActivity.JOPTIMIZER_LOGTAG, "Max iterations limit reached");
            break;
        }
    }

    long tStop = System.currentTimeMillis();
    Log.d(MainActivity.JOPTIMIZER_LOGTAG, "time: " + (tStop - tStart));
    response.setSolution(X.toArray());
    setOptimizationResponse(response);
    return response.getReturnCode();
}

From source file:com.samsung.spen.SpenPlugin.java

private void init() {
    if (isStatic == null || pluginMetadata == null) {
        mActivity = cordova.getActivity();
        String mPackageName = mActivity.getPackageName();
        PackageManager pm = mActivity.getPackageManager();
        try {//from  w w  w.  j a  v  a 2s.  c  o m
            ApplicationInfo ai = pm.getApplicationInfo(mPackageName, PackageManager.GET_META_DATA);
            if (ai.metaData != null) {
                pluginMetadata = ai.metaData.getBoolean(META_DATA);
            } else {
                pluginMetadata = false;
            }
        } catch (NameNotFoundException e) {
            pluginMetadata = false;
        }

        isStatic = false;
        int resId = mActivity.getResources().getIdentifier("spen_static", "bool", mActivity.getPackageName());
        try {
            if (resId != 0) {
                isStatic = mActivity.getResources().getBoolean(resId);
            }
        } catch (Resources.NotFoundException re) {
            isStatic = false;
        }
        if (Log.isLoggable(Utils.SPEN, Log.DEBUG)) {
            Log.d(TAG, "Static is " + isStatic);
        }
    }
}

From source file:com.kth.common.utils.etc.LogUtil.java

/**
 * DEBUG  ?./*  w w w. ja  va  2  s  .  c  om*/
 * 
 * @param clazz  ??  Class.
 * @param msg .
 * @param tr Throwable.
 */
public static void d(final Class<?> clazz, final String msg, final Throwable tr) {
    if (LogUtil.isDebugEnabled()) {
        Log.println(Log.DEBUG, TAG,
                LogUtil.getClassLineNumber(clazz) + " - " + msg + '\n' + Log.getStackTraceString(tr));

        //  ?? ?   ?.
        if (LogUtil.isFileLogEnabled()) {
            write(Log.DEBUG, LogUtil.getClassLineNumber(clazz), msg, tr);
        }
    }
}

From source file:com.example.android.elizachat.ResponderService.java

@Override
public void onDestroy() {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Chat Service stopped");
    }/*www.  jav  a2  s.c o m*/
    NotificationManagerCompat.from(this).cancel(0);
    mBroadcastManager = null;
    super.onDestroy();
}

From source file:com.android.screenspeak.eventprocessor.ProcessorEventQueue.java

/**
 * Processes an <code>event</code> by asking the
 * {@link EventSpeechRuleProcessor} to match it against its rules and in
 * case an utterance is generated it is spoken. This method is responsible
 * for recycling of the processed event.
 *
 * @param event The event to process./*  w  ww . java  2 s.  c  om*/
 */
private void processAndRecycleEvent(AccessibilityEvent event) {
    if (event == null)
        return;
    LogUtils.log(this, Log.DEBUG, "Processing event: %s", event);

    final Utterance utterance = new Utterance();

    if (mEventSpeechRuleProcessor.processEvent(event, utterance)) {
        if (mTestingListener != null) {
            mTestingListener.onUtteranceQueued(utterance);
        }

        provideFeedbackForUtterance(computeQueuingMode(utterance, event), utterance);
    } else {
        // Failed to match event to a rule, so the utterance is empty.
        LogUtils.log(this, Log.WARN, "Failed to process event");
    }

    event.recycle();
}

From source file:com.luorrak.ouroboros.services.ReplyCheckerService.java

private void getThreadJson(final String userPostBoardName, String userPostResto,
        final InfiniteDbHelper infiniteDbHelper, String userPostRowId, int userPostErrorCount) {
    JsonObject jsonObject = null;//ww w .j av  a 2s . c  o  m
    try {
        jsonObject = Ion.with(getApplicationContext())
                .load(ChanUrls.getThreadUrl(userPostBoardName, userPostResto))
                .setLogging("ReplyService", Log.DEBUG).asJsonObject().get();
    } catch (InterruptedException e) {
        userPostPrune(infiniteDbHelper, userPostRowId, userPostErrorCount);
    } catch (ExecutionException e) {
        userPostPrune(infiniteDbHelper, userPostRowId, userPostErrorCount);
    }
    if (jsonObject != null) {
        insertRCIntoDatabase(jsonObject, userPostBoardName, infiniteDbHelper);
        infiniteDbHelper.updateUserPostErrorCount(userPostRowId, 0);
    } else {
        userPostPrune(infiniteDbHelper, userPostRowId, userPostErrorCount);
    }
}