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:de.madvertise.android.sdk.MadvertiseView.java

private void showTextView() {
    MadvertiseUtil.logMessage(null, Log.DEBUG, "Add text banner");

    setBackgroundDrawable(sTextBannerBackground);
    MadvertiseTextView textBanner = new MadvertiseTextView(getContext().getApplicationContext(),
            mCurrentAd.getText(), mTextSize, mTextColor, mAnimationListener);

    // animate the old views
    animateOldViews();/*w ww .  ja  v a  2 s  .c  o m*/

    addView(textBanner);

    final Animation animation = createAnimation(false);
    if (animation != null) {
        textBanner.startAnimation(animation);
    }
}

From source file:com.example.android.wearable.agendadata.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "onActivityResult request/result codes: " + requestCode + "/" + resultCode);
    }//  w w  w.  jav  a2 s.  c  om

    if (requestCode == REQUEST_RESOLVE_ERROR) {
        mResolvingError = false;
        if (resultCode == RESULT_OK) {
            // Make sure the app is not already connected or attempting to connect
            if (!mGoogleApiClient.isConnecting() && !mGoogleApiClient.isConnected()) {
                mGoogleApiClient.connect();
            }
        }
    }
}

From source file:com.android.car.trust.CarBleTrustAgent.java

@Override
public void onEscrowTokenStateReceived(long handle, int tokenState) {
    boolean isActive = tokenState == TOKEN_STATE_ACTIVE;
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Token handle: " + handle + " isActive: " + isActive);
    }//ww w. java  2 s  .co m

    Intent intent = new Intent();
    intent.setAction(ACTION_TOKEN_STATUS_RESULT);
    intent.putExtra(INTENT_EXTRA_TOKEN_STATUS, isActive);

    mLocalBroadcastManager.sendBroadcast(intent);
}

From source file:com.android.mms.ui.ConversationListItem.java

public final void bind(Context context, final Conversation conversation) {
    //if (DEBUG) Log.v(TAG, "bind()");
    boolean sameItem = mConversation != null && mConversation.getThreadId() == conversation.getThreadId();

    mConversation = conversation;/*from w w  w. j  a v  a  2  s .  c o m*/

    LayoutParams attachmentLayout = (LayoutParams) mAttachmentView.getLayoutParams();
    boolean hasError = conversation.hasError();
    // When there's an error icon, the attachment icon is left of the error icon.
    // When there is not an error icon, the attachment icon is left of the date text.
    // As far as I know, there's no way to specify that relationship in xml.
    if (hasError) {
        attachmentLayout.addRule(RelativeLayout.LEFT_OF, R.id.error);
    } else {
        attachmentLayout.addRule(RelativeLayout.LEFT_OF, R.id.date);
    }

    boolean hasAttachment = conversation.hasAttachment();
    mAttachmentView.setVisibility(hasAttachment ? VISIBLE : GONE);

    // Date
    mDateView.setText(MessageUtils.formatTimeStampString(context, conversation.getDate()));

    // From.
    mFromView.setText(formatMessage());

    // Register for updates in changes of any of the contacts in this conversation.
    ContactList contacts = conversation.getRecipients();

    if (Log.isLoggable(LogTag.CONTACT, Log.DEBUG)) {
        Log.v(TAG, "bind: contacts.addListeners " + this);
    }
    Contact.addListener(this);

    // Subject
    SmileyParser parser = SmileyParser.getInstance();
    final String snippet = conversation.getSnippet();
    if (mConversation.hasUnreadMessages()) {
        SpannableStringBuilder buf = new SpannableStringBuilder(parser.addSmileySpans(snippet));
        buf.setSpan(STYLE_BOLD, 0, buf.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
        mSubjectView.setText(buf);
    } else {
        mSubjectView.setText(parser.addSmileySpans(snippet));
    }

    // Transmission error indicator.
    mErrorIndicator.setVisibility(hasError ? VISIBLE : GONE);

    updateAvatarView();
    mAvatarView.setChecked(isChecked(), sameItem);
}

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

private void showImageView() {
    MadvertiseUtil.logMessage(null, Log.DEBUG, "Add image banner");

    MadvertiseImageView imageView = new MadvertiseImageView(getContext().getApplicationContext(),
            mBannerWidthDp, mBannerHeightDp, mCurrentAd, mHandler, mAnimationListener);

    // animate the old views
    animateOldViews();//from  ww w.  jav  a 2 s. c  o m

    addView(imageView);

    final Animation animation = createAnimation(false);
    if (animation != null) {
        imageView.startAnimation(animation);
    }
}

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

/**
 * Starts a background thread to fetch a new ad. Method is called
 * from the refresh timer task/*w  w  w.j av a  2  s  . c o m*/
 */
private void requestNewAd() {
    MadUtil.logMessage(null, Log.DEBUG, "Trying to fetch a new ad");

    // exit if already requesting a new ad, not used yet
    if (runningRefreshAd) {
        MadUtil.logMessage(null, Log.DEBUG, "Another request is still in progress ...");
        return;
    }

    new Thread() {
        public void run() {
            // read all parameters, that we need for the request
            // get site token from manifest xml file
            String siteToken = MadUtil.getToken(getContext());
            if (siteToken == null) {
                siteToken = "";
                MadUtil.logMessage(null, Log.DEBUG, "Cannot show ads, since the appID ist null");
            } else {
                MadUtil.logMessage(null, Log.DEBUG, "appID = " + siteToken);
            }

            // get uid (does not work in emulator)
            String uid = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);
            if (uid == null) {
                uid = "";
            } else {
                uid = getMD5Hash(uid);
            }
            MadUtil.logMessage(null, Log.DEBUG, "uid = " + uid);

            // get display metrics
            Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE))
                    .getDefaultDisplay();
            int displayHeight = display.getHeight();
            int displayWidth = display.getWidth();
            MadUtil.logMessage(null, Log.DEBUG, "Display height = " + Integer.toString(displayHeight));
            MadUtil.logMessage(null, Log.DEBUG, "Display width = " + Integer.toString(displayWidth));

            // create post request
            HttpPost postRequest = new HttpPost(MadUtil.MAD_SERVER + "/site/" + siteToken);
            postRequest.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");

            List<NameValuePair> parameterList = new ArrayList<NameValuePair>();
            parameterList.add(new BasicNameValuePair("ua", MadUtil.getUA()));
            parameterList.add(new BasicNameValuePair("app", "true"));
            parameterList.add(new BasicNameValuePair("debug", Boolean.toString(testMode)));
            parameterList.add(new BasicNameValuePair("ip", MadUtil.getLocalIpAddress()));
            parameterList.add(new BasicNameValuePair("format", "json"));
            parameterList.add(new BasicNameValuePair("requester", "android_sdk"));
            parameterList.add(new BasicNameValuePair("version", "1.1"));
            parameterList.add(new BasicNameValuePair("uid", uid));
            parameterList.add(new BasicNameValuePair("banner_type", bannerType));
            parameterList.add(new BasicNameValuePair("deliver_only_text", Boolean.toString(deliverOnlyText)));

            MadUtil.refreshCoordinates(getContext());
            if (MadUtil.getLocation() != null) {
                parameterList.add(
                        new BasicNameValuePair("lat", Double.toString(MadUtil.getLocation().getLatitude())));
                parameterList.add(
                        new BasicNameValuePair("lng", Double.toString(MadUtil.getLocation().getLongitude())));
            }

            UrlEncodedFormEntity urlEncodedEntity = null;
            try {
                urlEncodedEntity = new UrlEncodedFormEntity(parameterList);
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }

            postRequest.setEntity(urlEncodedEntity);

            MadUtil.logMessage(null, Log.DEBUG, "Post request created");
            MadUtil.logMessage(null, Log.DEBUG, "Uri : " + postRequest.getURI().toASCIIString());
            MadUtil.logMessage(null, Log.DEBUG,
                    "All headers : " + MadUtil.getAllHeadersAsString(postRequest.getAllHeaders()));
            MadUtil.logMessage(null, Log.DEBUG,
                    "All request parameters :" + MadUtil.printRequestParameters(parameterList));

            synchronized (this) {
                // send blocking request to ad server
                HttpClient httpClient = new DefaultHttpClient();
                HttpResponse httpResponse = null;
                InputStream inputStream = null;
                boolean jsonFetched = false;
                JSONObject json = null;

                try {
                    HttpParams clientParams = httpClient.getParams();
                    HttpConnectionParams.setConnectionTimeout(clientParams,
                            MadUtil.CONNECTION_TIMEOUT.intValue());
                    HttpConnectionParams.setSoTimeout(clientParams, MadUtil.CONNECTION_TIMEOUT.intValue());

                    MadUtil.logMessage(null, Log.DEBUG, "Sending request");
                    httpResponse = httpClient.execute(postRequest);

                    MadUtil.logMessage(null, Log.DEBUG,
                            "Response Code => " + httpResponse.getStatusLine().getStatusCode());
                    if (testMode)
                        MadUtil.logMessage(null, Log.DEBUG, "Madvertise Debug Response: "
                                + httpResponse.getLastHeader("X-Madvertise-Debug"));
                    int responseCode = httpResponse.getStatusLine().getStatusCode();

                    HttpEntity entity = httpResponse.getEntity();

                    if (responseCode == 200 && entity != null) {
                        inputStream = entity.getContent();
                        String resultString = MadUtil.convertStreamToString(inputStream);
                        MadUtil.logMessage(null, Log.DEBUG, "Response => " + resultString);
                        json = new JSONObject(resultString);
                        jsonFetched = true;
                    }
                } catch (ClientProtocolException e) {
                    e.printStackTrace();
                    MadUtil.logMessage(null, Log.DEBUG, "Error in HTTP request / protocol");
                } catch (IOException e) {
                    e.printStackTrace();
                    MadUtil.logMessage(null, Log.DEBUG, "Could not receive a http response on an ad reqeust");
                } catch (JSONException e) {
                    e.printStackTrace();
                    MadUtil.logMessage(null, Log.DEBUG, "Could not parse json object");
                } finally {
                    if (inputStream != null)
                        try {
                            inputStream.close();
                        } catch (IOException e) {
                        }
                }

                // create ad, this is a blocking call
                if (jsonFetched) {
                    currentAd = new Ad(getContext(), json);
                }
            }
            mHandler.post(mUpdateResults);

        }
    }.start();
}

From source file:android.percent.support.PercentLayoutHelper.java

/**
 * Constructs a PercentLayoutInfo from attributes associated with a View. Call this method from
 * {@code LayoutParams(Context c, AttributeSet attrs)} constructor.
 *///from w  w w. j  a v  a  2s  .  com
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 = setTextSizeSupportVal(array, info);

    info = setMinMaxWidthHeightRelatedVal(array, info);

    info = setPaddingRelatedVal(array, info);

    array.recycle();

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

From source file:com.example.android.wearable.mjpegviewwear.MainActivity.java

/**
 * As simple wrapper around Log.d/*from   w  ww  .ja va  2 s. co  m*/
 */
private static void LOGD(final String tag, String message) {
    if (Log.isLoggable(tag, Log.DEBUG)) {
        Log.d(tag, message);
    }
}

From source file:com.radicaldynamic.groupinform.services.DatabaseService.java

public void performHousekeeping(String db) throws DbUnavailableException {
    final String tt = t + "performHousekeeping(String): ";

    // Determine if this database needs to be cleaned up
    Long lastCleanup = mDbLastCleanup.get(db);

    if (lastCleanup == null || System.currentTimeMillis() / 1000 - lastCleanup >= TIME_TEN_MINUTES) {
        if (Collect.Log.DEBUG)
            Log.d(Collect.LOGTAG, tt + "beginning cleanup for " + db);
        mDbLastCleanup.put(db, new Long(System.currentTimeMillis() / 1000));
        removePlaceholders(new FormDefinitionRepo(getDb()).getAllPlaceholders());
        removePlaceholders(new FormInstanceRepo(getDb()).getAllPlaceholders());
    }/*from w  w  w  .  ja  v a2s.com*/
}

From source file:org.ametro.app.ApplicationEx.java

private HttpClient createHttpClient() {
    if (Log.isLoggable(Constants.LOG_TAG_MAIN, Log.DEBUG)) {
        Log.d(Constants.LOG_TAG_MAIN, "Create HTTP client");
    }/*from w w  w . ja v  a2 s.co  m*/
    HttpParams params = new BasicHttpParams();
    HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
    HttpProtocolParams.setContentCharset(params, HTTP.DEFAULT_CONTENT_CHARSET);
    HttpProtocolParams.setUseExpectContinue(params, true);
    HttpConnectionParams.setConnectionTimeout(params, HTTP_CONNECTION_TIMEOUT);
    HttpConnectionParams.setSoTimeout(params, HTTP_SOCKET_TIMEOUT);

    SchemeRegistry schReg = new SchemeRegistry();
    schReg.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
    schReg.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
    ClientConnectionManager conMgr = new ThreadSafeClientConnManager(params, schReg);
    return new DefaultHttpClient(conMgr, params);
}