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.xandy.calendar.month.SimpleDayPickerFragment.java

/**
 * This moves to the specified time in the view. If the time is not already
 * in range it will move the list so that the first of the month containing
 * the time is at the top of the view. If the new time is already in view
 * the list will not be scrolled unless forceScroll is true. This time may
 * optionally be highlighted as selected as well.
 *
 * @param time The time to move to//from   w  w w  .j  a  v  a 2 s  . c om
 * @param animate Whether to scroll to the given time or just redraw at the
 *            new location
 * @param setSelected Whether to set the given time as selected
 * @param forceScroll Whether to recenter even if the time is already
 *            visible
 * @return Whether or not the view animated to the new location
 */
public boolean goTo(long time, boolean animate, boolean setSelected, boolean forceScroll) {
    if (time == -1) {
        Log.e(TAG, "time is invalid");
        return false;
    }

    // Set the selected day
    if (setSelected) {
        mSelectedDay.set(time);
        mSelectedDay.normalize(true);
    }

    // If this view isn't returned yet we won't be able to load the lists
    // current position, so return after setting the selected day.
    if (!isResumed()) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "We're not visible yet");
        }
        return false;
    }

    mTempTime.set(time);
    long millis = mTempTime.normalize(true);
    // Get the week we're going to
    // TODO push Util function into Calendar public api.
    int position = Utils.getWeeksSinceEpochFromJulianDay(Time.getJulianDay(millis, mTempTime.gmtoff),
            mFirstDayOfWeek);

    View child;
    int i = 0;
    int top = 0;
    // Find a child that's completely in the view
    do {
        child = mListView.getChildAt(i++);
        if (child == null) {
            break;
        }
        top = child.getTop();
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "child at " + (i - 1) + " has top " + top);
        }
    } while (top < 0);

    // Compute the first and last position visible
    int firstPosition;
    if (child != null) {
        firstPosition = mListView.getPositionForView(child);
    } else {
        firstPosition = 0;
    }
    int lastPosition = firstPosition + mNumWeeks - 1;
    if (top > BOTTOM_BUFFER) {
        lastPosition--;
    }

    if (setSelected) {
        mAdapter.setSelectedDay(mSelectedDay);
    }

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "GoTo position " + position);
    }
    // Check if the selected day is now outside of our visible range
    // and if so scroll to the month that contains it
    if (position < firstPosition || position > lastPosition || forceScroll) {
        mFirstDayOfMonth.set(mTempTime);
        mFirstDayOfMonth.monthDay = 1;
        millis = mFirstDayOfMonth.normalize(true);
        setMonthDisplayed(mFirstDayOfMonth, true);
        position = Utils.getWeeksSinceEpochFromJulianDay(Time.getJulianDay(millis, mFirstDayOfMonth.gmtoff),
                mFirstDayOfWeek);

        mPreviousScrollState = OnScrollListener.SCROLL_STATE_FLING;
        if (animate) {
            mListView.smoothScrollToPositionFromTop(position, LIST_TOP_OFFSET, GOTO_SCROLL_DURATION);
            return true;
        } else {
            mListView.setSelectionFromTop(position, LIST_TOP_OFFSET);
            // Perform any after scroll operations that are needed
            onScrollStateChanged(mListView, OnScrollListener.SCROLL_STATE_IDLE);
        }
    } else if (setSelected) {
        // Otherwise just set the selection
        setMonthDisplayed(mSelectedDay, true);
    }
    return false;
}

From source file:com.ty.highway.frameworklibrary.support.percent.PercentLayoutHelper.java

/**
 * Constructs a PercentLayoutInfo from attributes associated with a View.
 * Call this method from {@code LayoutParams(Context c, AttributeSet attrs)}
 * constructor.//www  .j  a  va 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);

    int index = R.styleable.PercentLayout_Layout_layout_widthPercent;
    String sizeStr = array.getString(index);
    PercentLayoutInfo.PercentVal percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent width: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.widthPercent = percentVal;
    }
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_heightPercent);
    percentVal = getPercentVal(sizeStr, false);

    if (sizeStr != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent height: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.heightPercent = percentVal;
    }

    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginPercent,
    // 1, 1, -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginPercent);
    // just for judge
    percentVal = getPercentVal(sizeStr, false);

    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.leftMarginPercent = getPercentVal(sizeStr, true);
        info.topMarginPercent = getPercentVal(sizeStr, false);
        info.rightMarginPercent = getPercentVal(sizeStr, true);
        info.bottomMarginPercent = getPercentVal(sizeStr, false);
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginLeftPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginLeftPercent);
    percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent left margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.leftMarginPercent = percentVal;
    }

    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginTopPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginTopPercent);
    percentVal = getPercentVal(sizeStr, false);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent top margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.topMarginPercent = percentVal;
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginRightPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginRightPercent);
    percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent right margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.rightMarginPercent = percentVal;
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginBottomPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginBottomPercent);
    percentVal = getPercentVal(sizeStr, false);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent bottom margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.bottomMarginPercent = percentVal;
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginStartPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginStartPercent);
    percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent start margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.startMarginPercent = percentVal;
    }
    // value =
    // array.getFraction(R.styleable.PercentLayout_Layout_layout_marginEndPercent,
    // 1, 1,
    // -1f);
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_marginEndPercent);
    percentVal = getPercentVal(sizeStr, true);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent end margin: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.endMarginPercent = percentVal;
    }

    // textSizePercent
    sizeStr = array.getString(R.styleable.PercentLayout_Layout_layout_textSizePercent);
    percentVal = getPercentVal(sizeStr, false);
    if (percentVal != null) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "percent text size: " + percentVal.percent);
        }
        info = checkForInfoExists(info);
        info.textSizePercent = percentVal;
    }

    // maxWidth
    percentVal = getPercentVal(array, R.styleable.PercentLayout_Layout_layout_maxWidthPercent, true);
    if (percentVal != null) {
        checkForInfoExists(info);
        info.maxWidthPercent = percentVal;
    }
    // maxHeight
    percentVal = getPercentVal(array, R.styleable.PercentLayout_Layout_layout_maxHeightPercent, false);
    if (percentVal != null) {
        checkForInfoExists(info);
        info.maxHeightPercent = percentVal;
    }
    // minWidth
    percentVal = getPercentVal(array, R.styleable.PercentLayout_Layout_layout_minWidthPercent, true);
    if (percentVal != null) {
        checkForInfoExists(info);
        info.minWidthPercent = percentVal;
    }
    // minHeight
    percentVal = getPercentVal(array, R.styleable.PercentLayout_Layout_layout_minHeightPercent, false);
    Log.d(TAG, "minHeight = " + percentVal);
    if (percentVal != null) {
        checkForInfoExists(info);
        info.minHeightPercent = percentVal;
    }

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

From source file:com.ntsync.android.sync.activities.ShopActivity.java

@Override
protected void onResumeFragments() {
    super.onResumeFragments();
    // Process a PaymentResult from onActivityResult
    if (paymentResult != null) {
        int resultCode = paymentResult.resultCode;
        PaymentConfirmation confirm = paymentResult.confirmation;
        paymentResult = null;/*w  w w  .  jav  a2 s.  c o  m*/
        if (resultCode == Activity.RESULT_OK && confirm != null) {
            if (selectedPriceId == null) {
                MessageDialog.show(R.string.shop_activity_missingprice, this);
                return;
            }

            JSONObject paymentJson = confirm.toJSONObject();
            // Save Payment, so that payment can be verified later.
            Account account = new Account(accountName, Constants.ACCOUNT_TYPE);
            AccountManager accountManager = AccountManager.get(this);
            SyncUtils.savePayment(account, accountManager, paymentJson, selectedPriceId);

            SyncUtils.startPaymentVerification();
            // Start Timer to verify Payment if Verification could not be
            // done now.
            PaymentVerificationService.startVerificationTimer(getApplicationContext());

            // Send Confirmation to server
            boolean verifStarted = false;
            try {
                String jsonData = paymentJson.toString(1);
                VerifyPaymentProgressDialog progressDialog = VerifyPaymentProgressDialog
                        .newInstance(selectedPriceId, jsonData, accountName);
                progressDialog.show(this.getSupportFragmentManager(), "VerifyPaymentProgressDialog");
                if (Log.isLoggable(TAG, Log.DEBUG)) {
                    Log.d(TAG, "PaymentConfirmation: " + jsonData);
                }
                verifStarted = true;
            } catch (JSONException e) {
                MessageDialog.show(R.string.shop_activity_invalidsyntax, this);
                Log.e(TAG, "Failed to convert Payment to JSON.", e);
                SyncUtils.savePayment(account, accountManager, null, null);
            } finally {
                if (!verifStarted) {
                    SyncUtils.stopPaymentVerification();
                }
            }
        } else if (resultCode == Activity.RESULT_CANCELED) {
            Log.i(TAG, "The user canceled the payment-flow");
        } else if (resultCode == PaymentActivity.RESULT_PAYMENT_INVALID) {
            MessageDialog.show(R.string.shop_activity_invalidpayment, this);
            Log.i(TAG, "An invalid payment was submitted.");
        } else {
            MessageDialog.show(R.string.shop_activity_invalidpayment, this);
            Log.e(TAG, "PaymentResult is unknown. Result:" + resultCode + " Confirmation:" + confirm);
        }
    }
    getSupportLoaderManager().initLoader(LOADID_PRICES, null, this);
    View progressBar = findViewById(R.id.progressBar);
    View reloadBtn = findViewById(R.id.reloadBtn);
    reloadBtn.setVisibility(View.GONE);
    progressBar.setVisibility(View.VISIBLE);
    getListView().setEmptyView(progressBar);

    // Show a Message from a delayed Verification
    String msg = getIntent().getStringExtra(PARM_MSG);
    if (msg != null) {
        MessageDialog.show(msg, this);
        getIntent().removeExtra(PARM_MSG);
    }
}

From source file:br.com.bioscada.apps.biotracks.io.gdata.AndroidGDataClient.java

private HttpEntity createEntityForEntry(GDataSerializer entry, int format) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {//  w w  w .  j av  a2s .  c om
        entry.serialize(baos, format);
    } catch (IOException ioe) {
        Log.e(TAG, "Unable to serialize entry.", ioe);
        throw ioe;
    } catch (ParseException pe) {
        Log.e(TAG, "Unable to serialize entry.", pe);
        throw new IOException("Unable to serialize entry: " + pe.getMessage());
    }

    byte[] entryBytes = baos.toByteArray();

    if (entryBytes != null && Log.isLoggable(TAG, Log.DEBUG)) {
        try {
            Log.d(TAG, "Serialized entry: " + new String(entryBytes, "UTF-8"));
        } catch (UnsupportedEncodingException uee) {
            // should not happen
            throw new IllegalStateException("UTF-8 should be supported!", uee);
        }
    }

    AbstractHttpEntity entity = new ByteArrayEntity(entryBytes);
    entity.setContentType(entry.getContentType());
    return entity;
}

From source file:de.madvertise.android.sdk.MadvertiseView.java

/**
 * Convenience method to notify the callback listener
 *
 * @param succeed//w  w w  .ja  va 2 s  .  co  m
 */
private void notifyListener(final boolean succeed) {
    if (mCallbackListener != null) {
        mCallbackListener.onLoaded(succeed, this);
    } else {
        MadvertiseUtil.logMessage(null, Log.DEBUG, "Callback Listener not set");
    }
}

From source file:com.android.calendar.month.SimpleDayPickerFragment.java

/**
 * This moves to the specified time in the view. If the time is not already
 * in range it will move the list so that the first of the month containing
 * the time is at the top of the view. If the new time is already in view
 * the list will not be scrolled unless forceScroll is true. This time may
 * optionally be highlighted as selected as well.
 *
 * @param time//w ww.j a  va 2s  .  c  o  m
 *            The time to move to
 * @param animate
 *            Whether to scroll to the given time or just redraw at the new
 *            location
 * @param setSelected
 *            Whether to set the given time as selected
 * @param forceScroll
 *            Whether to recenter even if the time is already visible
 * @return Whether or not the view animated to the new location
 */
public boolean goTo(long time, boolean animate, boolean setSelected, boolean forceScroll) {
    if (time == -1) {
        Log.e(TAG, "time is invalid");
        return false;
    }

    // Set the selected day
    if (setSelected) {
        mSelectedDay.set(time);
        mSelectedDay.normalize(true);
    }

    // If this view isn't returned yet we won't be able to load the lists
    // current position, so return after setting the selected day.
    if (!isResumed()) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "We're not visible yet");
        }
        return false;
    }

    mTempTime.set(time);
    long millis = mTempTime.normalize(true);
    // Get the week we're going to
    // TODO push Util function into Calendar public api.
    int position = Utils.getWeeksSinceEpochFromJulianDay(Time.getJulianDay(millis, mTempTime.gmtoff),
            mFirstDayOfWeek);

    View child;
    int i = 0;
    int top = 0;
    // Find a child that's completely in the view
    do {
        child = mListView.getChildAt(i++);
        if (child == null) {
            break;
        }
        top = child.getTop();
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "child at " + (i - 1) + " has top " + top);
        }
    } while (top < 0);

    // Compute the first and last position visible
    int firstPosition;
    if (child != null) {
        firstPosition = mListView.getPositionForView(child);
    } else {
        firstPosition = 0;
    }
    int lastPosition = firstPosition + mNumWeeks - 1;
    if (top > BOTTOM_BUFFER) {
        lastPosition--;
    }

    if (setSelected) {
        mAdapter.setSelectedDay(mSelectedDay);
    }

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "GoTo position " + position);
    }
    // Check if the selected day is now outside of our visible range
    // and if so scroll to the month that contains it
    if (position < firstPosition || position > lastPosition || forceScroll) {
        JalaliDate jDate = Jalali.gregorianToJalali(mTempTime);
        jDate.day = 1;
        mFirstDayOfMonth.set(Jalali.jalaliToGregorianTime(jDate));
        mFirstDayOfMonth.normalize(true);
        setMonthDisplayed(mFirstDayOfMonth, jDate.month - 1, true);
        position = Utils.getWeeksSinceEpochFromJulianDay(
                Time.getJulianDay(Jalali.jalaliToGregorianTime(jDate).toMillis(true), mFirstDayOfMonth.gmtoff),
                mFirstDayOfWeek);

        mPreviousScrollState = OnScrollListener.SCROLL_STATE_FLING;
        if (animate) {
            mListView.smoothScrollToPositionFromTop(position, LIST_TOP_OFFSET, GOTO_SCROLL_DURATION);
            return true;
        } else {
            mListView.setSelectionFromTop(position, LIST_TOP_OFFSET);
            // Perform any after scroll operations that are needed
            onScrollStateChanged(mListView, OnScrollListener.SCROLL_STATE_IDLE);
        }
    } else if (setSelected) {
        // Otherwise just set the selection
        setMonthDisplayed(mSelectedDay, Jalali.gregorianToJalali(mSelectedDay).month - 1, true);
    }
    return false;
}

From source file:com.radicaldynamic.groupinform.activities.LauncherActivity.java

@Override
protected void onDestroy() {
    super.onDestroy();

    final String tt = t + "onDestroy(): ";

    // Unbind from our services
    if (Collect.getInstance().getCouchService() instanceof ServiceConnection) {
        try {//  w w  w .j  a v  a 2  s.c  o  m
            if (Collect.Log.DEBUG)
                Log.d(Collect.LOGTAG, tt + "unbinding from CouchService");
            unbindService(Collect.getInstance().getCouchService());
        } catch (IllegalArgumentException e) {
            if (Collect.Log.WARN)
                Log.w(Collect.LOGTAG, tt + "CouchService not registered: " + e.toString());
        }
    }

    if (Collect.getInstance().getDbService() instanceof DatabaseService) {
        try {
            if (Collect.Log.DEBUG)
                Log.d(Collect.LOGTAG, tt + "unbinding from DatabaseService");
            unbindService(mDatabaseConnection);
        } catch (IllegalArgumentException e) {
            if (Collect.Log.WARN)
                Log.w(Collect.LOGTAG, tt + "DatabaseService not registered: " + e.toString());
        }
    }

    if (Collect.getInstance().getIoService() instanceof InformOnlineService) {
        try {
            if (Collect.Log.DEBUG)
                Log.d(Collect.LOGTAG, tt + "unbinding from InformOnlineService");
            unbindService(mOnlineConnection);
        } catch (IllegalArgumentException e) {
            if (Collect.Log.WARN)
                Log.w(Collect.LOGTAG, tt + "InformOnlineService not registered: " + e.toString());
        }
    }

    // User has reset GC Mobile (see http://stackoverflow.com/questions/2042222/close-application)
    if (mExitApplication) {
        exitApplication();
    }
}

From source file:com.samsung.richnotification.RichNotification.java

@Override
public void onDestroy() {
    super.onDestroy();
    if (richRemoteInputReceiver != null) {
        try {/* w ww.  j  a  v a2s  .  com*/
            this.cordova.getActivity().unregisterReceiver(richRemoteInputReceiver);
            richRemoteInputReceiver = null;
        } catch (IllegalArgumentException e) {
            //not an error case
            if (Log.isLoggable(RICHNOTI, Log.DEBUG))
                Log.d(TAG, "unregistering receiver in onDestroy: " + e.getMessage());
            e.printStackTrace();
        }
    }
}

From source file:com.samsung.multiwindow.MultiWindow.java

/**
 * Checks if the device supports Multiwindow feature of specified window
 * type.//from w w  w  .  j a  v a  2 s. c  o m
 * 
 * @param windowType
 *            The window type freestyle or splitstyle.
 * @param callbackContext
 *            The callback id used when calling back into JavaScript.
 * @return true if window type is supported or false if windowType is not supported.
 * 
 */
private boolean isMultiWindowSupported(final String windowType) {

    if (Log.isLoggable(MULTIWINDOW, Log.DEBUG)) {
        Log.d(TAG, "Inside isMultiWindowSupported");
    }

    if (windowType.equalsIgnoreCase("freestyle") && mMultiWindow.isFeatureEnabled(SMultiWindow.FREE_STYLE)) {
        return true;
    } else if (windowType.equalsIgnoreCase("splitstyle")
            && mMultiWindow.isFeatureEnabled(SMultiWindow.MULTIWINDOW)) {
        return true;
    }

    return false;
}

From source file:com.luorrak.ouroboros.thread.ThreadFragment.java

private void getThreadJson(final Context context, final String boardName, final String threadNumber) {
    progressBar.setVisibility(View.VISIBLE);
    final String threadJsonUrl = ChanUrls.getThreadUrl(boardName, threadNumber);

    Ion.with(context).load(threadJsonUrl).setLogging(LOG_TAG, Log.DEBUG).asJsonObject()
            .setCallback(new FutureCallback<JsonObject>() {

                @Override/*from   w  w  w  .  ja v a  2s  . c  o  m*/
                public void onCompleted(Exception e, JsonObject jsonObject) {
                    if (getActivity() != null) {
                        if (e == null) {
                            if (jsonObject.toString().equals(oldJsonString)) {
                                pollingInterval = pollingInterval + pollingInterval / 2;
                                progressBar.setVisibility(View.INVISIBLE);
                            } else {
                                restartStatusCheck();
                                oldJsonString = jsonObject.toString();
                                networkFragment.beginTask(jsonObject, infiniteDbHelper, boardName, resto,
                                        threadPosition, firstRequest, recyclerView, threadAdapter);
                            }
                        } else {
                            progressBar.setVisibility(View.INVISIBLE);
                            Snackbar.make(getView(), "Error retrieving thread", Snackbar.LENGTH_LONG).show();
                        }
                    }
                    firstRequest = false;
                }
            });
}