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:android.support.wear.widget.drawer.WearableDrawerLayout.java

/**
 * Peek the drawer.//from  w  w  w .j ava2  s  .c  om
 *
 * @param gravity {@link Gravity#TOP} to peek the top drawer or {@link Gravity#BOTTOM} to peek
 * the bottom drawer.
 */
void peekDrawer(final int gravity) {
    if (!isLaidOut()) {
        // If this view is not laid out yet, postpone the peek until onLayout is called.
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "WearableDrawerLayout not laid out yet. Postponing peek.");
        }
        switch (gravity) {
        case Gravity.TOP:
            mShouldPeekTopDrawerAfterLayout = true;
            break;
        case Gravity.BOTTOM:
            mShouldPeekBottomDrawerAfterLayout = true;
            break;
        default: // fall out
        }
        return;
    }
    final WearableDrawerView drawerView = findDrawerWithGravity(gravity);
    maybePeekDrawer(drawerView);
}

From source file:com.irccloud.android.data.collection.NotificationsList.java

private void showOtherNotifications() {
    String title = "";
    String text = "";
    String ticker;/*from  w  w  w  .  ja va  2  s . co  m*/
    NotificationCompat.Action action = null;
    SharedPreferences prefs = PreferenceManager
            .getDefaultSharedPreferences(IRCCloudApplication.getInstance().getApplicationContext());
    final List<Notification> notifications = getOtherNotifications();

    int notify_type = Integer.parseInt(prefs.getString("notify_type", "1"));
    boolean notify = false;
    if (notify_type == 1 || (notify_type == 2 && NetworkConnection.getInstance().isVisible()))
        notify = true;

    if (notifications.size() > 0 && notify) {
        for (Notification n : notifications) {
            if (!n.shown) {
                Crashlytics.log(Log.DEBUG, "IRCCloud", "Posting notification for type " + n.message_type);
                if (n.message_type.equals("callerid")) {
                    title = n.network;
                    text = n.nick + " is trying to contact you";
                    ticker = n.nick + " is trying to contact you on " + n.network;

                    Intent i = new Intent(RemoteInputService.ACTION_REPLY);
                    i.setComponent(new ComponentName(
                            IRCCloudApplication.getInstance().getApplicationContext().getPackageName(),
                            RemoteInputService.class.getName()));
                    i.putExtra("cid", n.cid);
                    i.putExtra("eid", n.eid);
                    i.putExtra("chan", n.chan);
                    i.putExtra("buffer_type", n.buffer_type);
                    i.putExtra("network", n.network);
                    i.putExtra("to", n.nick);
                    i.putExtra("reply", "/accept " + n.nick);
                    action = new NotificationCompat.Action(R.drawable.ic_wearable_add, "Accept",
                            PendingIntent.getService(IRCCloudApplication.getInstance().getApplicationContext(),
                                    (int) (n.eid / 1000), i, PendingIntent.FLAG_UPDATE_CURRENT));
                } else if (n.message_type.equals("callerid_success")) {
                    title = n.network;
                    text = n.nick + " has been added to your accept list";
                    ticker = n.nick + " has been added to your accept list on " + n.network;
                    Intent i = new Intent(RemoteInputService.ACTION_REPLY);
                    i.setComponent(new ComponentName(
                            IRCCloudApplication.getInstance().getApplicationContext().getPackageName(),
                            RemoteInputService.class.getName()));
                    i.putExtra("cid", n.cid);
                    i.putExtra("eid", n.eid);
                    i.putExtra("chan", n.chan);
                    i.putExtra("buffer_type", n.buffer_type);
                    i.putExtra("network", n.network);
                    i.putExtra("to", n.nick);
                    action = new NotificationCompat.Action.Builder(R.drawable.ic_wearable_reply, "Message",
                            PendingIntent.getService(IRCCloudApplication.getInstance().getApplicationContext(),
                                    (int) (n.eid / 1000), i, PendingIntent.FLAG_UPDATE_CURRENT))
                                            .setAllowGeneratedReplies(true)
                                            .addRemoteInput(new RemoteInput.Builder("extra_reply")
                                                    .setLabel("Message to " + n.nick).build())
                                            .build();
                } else if (n.message_type.equals("channel_invite")) {
                    title = n.network;
                    text = n.nick + " invited you to join " + n.chan;
                    ticker = text;
                    try {
                        Intent i = new Intent();
                        i.setComponent(new ComponentName(
                                IRCCloudApplication.getInstance().getApplicationContext().getPackageName(),
                                "com.irccloud.android.MainActivity"));
                        i.setData(Uri.parse(IRCCloudApplication.getInstance().getResources()
                                .getString(R.string.IRCCLOUD_SCHEME) + "://cid/" + n.cid + "/"
                                + URLEncoder.encode(n.chan, "UTF-8")));
                        i.putExtra("eid", n.eid);
                        action = new NotificationCompat.Action(R.drawable.ic_wearable_add, "Join",
                                PendingIntent.getActivity(
                                        IRCCloudApplication.getInstance().getApplicationContext(),
                                        (int) (n.eid / 1000), i, PendingIntent.FLAG_UPDATE_CURRENT));
                    } catch (Exception e) {
                        action = null;
                    }
                } else {
                    title = n.nick;
                    text = n.message;
                    ticker = n.message;
                    action = null;
                }
                if (title != null && text != null)
                    NotificationManagerCompat.from(IRCCloudApplication.getInstance().getApplicationContext())
                            .notify((int) (n.eid / 1000), buildNotification(ticker, n.cid, n.bid,
                                    new long[] { n.eid }, title, text, 1, null, n.network, null, action,
                                    AvatarsList.getInstance().getAvatar(n.cid, n.nick).getBitmap(false,
                                            (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 64,
                                                    IRCCloudApplication.getInstance().getApplicationContext()
                                                            .getResources().getDisplayMetrics()),
                                            false, Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP),
                                    AvatarsList.getInstance().getAvatar(n.cid, n.nick).getBitmap(false, 400,
                                            false, false)));
            }
        }
        TransactionManager.transact(IRCCloudDatabase.NAME, new Runnable() {
            @Override
            public void run() {
                for (Notification n : notifications) {
                    n.delete();
                }
            }
        });
    }
}

From source file:com.android.contacts.DynamicShortcuts.java

private void removeAllShortcuts() {
    mShortcutManager.removeAllDynamicShortcuts();

    final List<ShortcutInfo> pinned = mShortcutManager.getPinnedShortcuts();
    final List<String> ids = new ArrayList<>(pinned.size());
    for (ShortcutInfo shortcut : pinned) {
        ids.add(shortcut.getId());// w ww  .  jav  a 2s . co m
    }
    mShortcutManager.disableShortcuts(ids, mContext.getString(R.string.dynamic_shortcut_disabled_message));
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "DynamicShortcuts have been removed.");
    }
}

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

@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
    MadUtil.logMessage(null, Log.DEBUG, "#### onWindowFocusChanged fired ####");
    refreshAdTimer(hasWindowFocus);// www .  ja v  a 2s .co  m
    super.onWindowFocusChanged(hasWindowFocus);
}

From source file:com.android.contacts.DynamicShortcuts.java

public synchronized static void initialize(Context context) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        final Flags flags = Flags.getInstance();
        Log.d(TAG, "DyanmicShortcuts.initialize\nVERSION >= N_MR1? "
                + (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) + "\nisJobScheduled? "
                + (CompatUtils.isLauncherShortcutCompatible() && isJobScheduled(context)) + "\nminDelay="
                + flags.getInteger(Experiments.DYNAMIC_MIN_CONTENT_CHANGE_UPDATE_DELAY_MILLIS) + "\nmaxDelay="
                + flags.getInteger(Experiments.DYNAMIC_MAX_CONTENT_CHANGE_UPDATE_DELAY_MILLIS));
    }/*from   w w w  . ja v a  2  s.  c  om*/

    if (!CompatUtils.isLauncherShortcutCompatible())
        return;

    final DynamicShortcuts shortcuts = new DynamicShortcuts(context);

    if (!shortcuts.hasRequiredPermissions()) {
        final IntentFilter filter = new IntentFilter();
        filter.addAction(RequestPermissionsActivity.BROADCAST_PERMISSIONS_GRANTED);
        LocalBroadcastManager.getInstance(shortcuts.mContext).registerReceiver(new PermissionsGrantedReceiver(),
                filter);
    } else if (!isJobScheduled(context)) {
        // Update the shortcuts. If the job is already scheduled then either the app is being
        // launched to run the job in which case the shortcuts will get updated when it runs or
        // it has been launched for some other reason and the data we care about for shortcuts
        // hasn't changed. Because the job reschedules itself after completion this check
        // essentially means that this will run on each app launch that happens after a reboot.
        // Note: the task schedules the job after completing.
        new ShortcutUpdateTask(shortcuts).execute();
    }
}

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

@Override
protected void onAttachedToWindow() {
    MadUtil.logMessage(null, Log.DEBUG, "#### onAttachedToWindow fired ####");
    refreshAdTimer(true);/*w  ww  .j  a  v a  2  s. com*/
    super.onAttachedToWindow();
}

From source file:de.tubs.ibr.dtn.service.DaemonService.java

/**
 * Initialize the daemon service This should be the first job of the service
 * after creation/*from   w  w w .j  a va2 s . com*/
 */
private void initialize() {
    // initialize the basic daemon
    mDaemonProcess.initialize();

    // restore registrations
    mSessionManager.initialize();

    if (Log.isLoggable(TAG, Log.DEBUG))
        Log.d(TAG, "DaemonService created");

    // start daemon if enabled
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    // listen to preference changes
    prefs.registerOnSharedPreferenceChangeListener(_pref_listener);

    if (prefs.getBoolean(Preferences.KEY_ENABLED, true)) {
        // startup the daemon process
        final Intent intent = new Intent(this, DaemonService.class);
        intent.setAction(de.tubs.ibr.dtn.service.DaemonService.ACTION_STARTUP);
        startService(intent);
    }
}

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

@Override
protected void onDetachedFromWindow() {
    MadUtil.logMessage(null, Log.DEBUG, "#### onDetachedFromWindow fired ####");
    refreshAdTimer(false);/*from  www  . j a va  2 s .  com*/
    super.onDetachedFromWindow();
}

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

@Override
//On RichNotification Removed from the gear
public void onRemoved(UUID arg0) {
    if (mCallbackContext == null)
        return;/*from  w ww  .  j  a  va  2 s.  c  o m*/
    try {
        JSONObject eventMsg = new JSONObject();
        eventMsg.put("returnType", RichNotificationHelper.RETURN_TYPE_NOTIFICATION_REMOVED);
        eventMsg.put("returnValue", arg0.toString());
        PluginResult sentResult = new PluginResult(PluginResult.Status.OK, eventMsg);
        sentResult.setKeepCallback(true);
        mCallbackContext.sendPluginResult(sentResult);
    } catch (JSONException jse) {
        if (Log.isLoggable(RICHNOTI, Log.DEBUG))
            Log.d(TAG, "Gear input invalid");
        return;
    }
}

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

private void serializeSession() {
    // Attempt to serialize the session for later use
    if (Collect.getInstance().getInformOnlineState().getSession() instanceof CookieStore) {
        if (Collect.Log.DEBUG)
            Log.d(Collect.LOGTAG, t + "serializing session");

        try {//  w  w w.j  a v  a  2  s.  c o m
            InformOnlineSession session = new InformOnlineSession();

            Iterator<Cookie> cookies = Collect.getInstance().getInformOnlineState().getSession().getCookies()
                    .iterator();

            while (cookies.hasNext()) {
                Cookie c = cookies.next();
                session.getCookies().add(new InformOnlineSession(c.getDomain(), c.getExpiryDate(), c.getName(),
                        c.getPath(), c.getValue(), c.getVersion()));
            }

            FileOutputStream fos = new FileOutputStream(
                    new File(getCacheDir(), FileUtilsExtended.SESSION_CACHE_FILE));
            ObjectOutputStream out = new ObjectOutputStream(fos);
            out.writeObject(session);
            out.close();
            fos.close();
        } catch (Exception e) {
            if (Collect.Log.WARN)
                Log.w(Collect.LOGTAG, t + "problem serializing session " + e.toString());
            e.printStackTrace();

            // Make sure that we don't leave a broken file hanging
            new File(getCacheDir(), FileUtilsExtended.SESSION_CACHE_FILE).delete();
        }
    } else {
        if (Collect.Log.DEBUG)
            Log.d(Collect.LOGTAG, t + "no session to serialize");
    }
}