Example usage for android.util Log WARN

List of usage examples for android.util Log WARN

Introduction

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

Prototype

int WARN

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

Click Source Link

Document

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

Usage

From source file:com.google.android.marvin.mytalkback.formatter.EventSpeechRule.java

/**
 * Factory method that creates all speech rules from the DOM representation
 * of a speechstrategy.xml. This class does not verify if the <code>document</code>
 * is well-formed and it is responsibility of the client to do that.
 *
 * @param context A {@link Context} instance for loading resources.
 * @param document The parsed XML./*from  w  w w  . j a va  2s  .c o  m*/
 * @return The list of loaded speech rules.
 */
public static ArrayList<EventSpeechRule> createSpeechRules(TalkBackService context, Document document)
        throws IllegalStateException {
    final ArrayList<EventSpeechRule> speechRules = new ArrayList<EventSpeechRule>();

    if (document == null || context == null) {
        return speechRules;
    }

    final NodeList children = document.getDocumentElement().getChildNodes();

    for (int i = 0, count = children.getLength(); i < count; i++) {
        final Node child = children.item(i);

        if (child.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        try {
            final EventSpeechRule rule = new EventSpeechRule(context, child, i);

            speechRules.add(rule);
        } catch (Exception e) {
            e.printStackTrace();

            LogUtils.log(EventSpeechRule.class, Log.WARN, "Failed loading speech rule: %s",
                    getTextContent(child));
        }
    }

    return speechRules;
}

From source file:com.android.talkback.formatter.EventSpeechRule.java

/**
 * Factory method that creates all speech rules from the DOM representation
 * of a speechstrategy.xml. This class does not verify if the <code>document</code>
 * is well-formed and it is responsibility of the client to do that.
 *
 * @param context A {@link Context} instance for loading resources.
 * @param document The parsed XML./*from  w  w  w. j a  v  a2  s  . c  o m*/
 * @return The list of loaded speech rules.
 */
public static ArrayList<EventSpeechRule> createSpeechRules(TalkBackService context, Document document)
        throws IllegalStateException {
    final ArrayList<EventSpeechRule> speechRules = new ArrayList<>();

    if (document == null || context == null) {
        return speechRules;
    }

    final NodeList children = document.getDocumentElement().getChildNodes();

    for (int i = 0, count = children.getLength(); i < count; i++) {
        final Node child = children.item(i);

        if (child.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }

        try {
            final EventSpeechRule rule = new EventSpeechRule(context, child, i);

            speechRules.add(rule);
        } catch (Exception e) {
            e.printStackTrace();

            LogUtils.log(EventSpeechRule.class, Log.WARN, "Failed loading speech rule: %s",
                    getTextContent(child));
        }
    }

    return speechRules;
}

From source file:org.springframework.web.client.RestTemplate.java

private void handleResponseError(HttpMethod method, URI url, ClientHttpResponse response) throws IOException {
    if (Log.isLoggable(TAG, Log.WARN)) {
        try {/*from w w w.j a v a 2s  .c  o m*/
            Log.w(TAG, method.name() + " request for \"" + url + "\" resulted in " + response.getStatusCode()
                    + " (" + response.getStatusText() + "); invoking error handler");
        } catch (IOException e) {
            // ignore
        }
    }
    getErrorHandler().handleError(response);
}

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

private void synchronizeLocalDBs() {
    final String tt = t + "synchronizeLocalDBs(): ";

    // Do we use automatic synchronization?
    SharedPreferences settings = PreferenceManager
            .getDefaultSharedPreferences(Collect.getInstance().getBaseContext());

    // How often should we automatically synchronize databases?
    String syncInterval = settings.getString(PreferencesActivity.KEY_SYNCHRONIZATION_INTERVAL,
            Integer.toString(TIME_FIVE_MINUTES));

    if (settings.getBoolean(PreferencesActivity.KEY_AUTOMATIC_SYNCHRONIZATION, true)) {
        Set<String> folderSet = Collect.getInstance().getInformOnlineState().getAccountFolders().keySet();
        Iterator<String> folderIds = folderSet.iterator();

        while (folderIds.hasNext()) {
            AccountFolder folder = Collect.getInstance().getInformOnlineState().getAccountFolders()
                    .get(folderIds.next());

            if (folder.isReplicated()) {
                // Determine if this database needs to be replicated
                Long lastUpdate = mDbLastReplication.get(folder.getId());

                if (lastUpdate == null
                        || System.currentTimeMillis() / 1000 - lastUpdate >= Integer.parseInt(syncInterval)) {
                    mDbLastReplication.put(folder.getId(), new Long(System.currentTimeMillis() / 1000));

                    if (Collect.Log.INFO)
                        Log.i(Collect.LOGTAG,
                                tt + "about to begin automatic replication of " + folder.getName());

                    try {
                        replicate(folder.getId(), REPLICATE_PULL);
                        replicate(folder.getId(), REPLICATE_PUSH);
                    } catch (Exception e) {
                        if (Collect.Log.WARN)
                            Log.w(Collect.LOGTAG,
                                    tt + "problem replicating " + folder.getId() + ": " + e.toString());
                        e.printStackTrace();
                    }/*  w w  w  . ja v  a2  s .  co  m*/
                } else {
                    if (Collect.Log.DEBUG)
                        Log.d(Collect.LOGTAG, tt + "skipping automatic replication of " + folder.getName()
                                + ": last synchronization too recent");
                }
            }
        }
    } else {
        if (Collect.Log.DEBUG)
            Log.d(Collect.LOGTAG, tt + "skipping (automatic synchronization disabled)");
    }
}

From source file:com.android.screenspeak.controller.CursorControllerApp.java

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUSED) {
        final AccessibilityNodeInfo node = event.getSource();
        if (node == null) {
            if (LogUtils.LOG_LEVEL <= Log.WARN) {
                Log.w(LOGTAG, "TYPE_VIEW_ACCESSIBILITY_FOCUSED event without a source.");
            }/*from w  ww.java  2s. c  om*/
            return;
        }

        // When a new view gets focus, clear the state of the granularity
        // manager if this event came from a different node than the locked
        // node but from the same window.
        final AccessibilityNodeInfoCompat nodeCompat = new AccessibilityNodeInfoCompat(node);
        mGranularityManager.onNodeFocused(nodeCompat);
        if (mSwitchNodeWithGranularityDirection == TraversalStrategy.SEARCH_FOCUS_FORWARD) {
            mGranularityManager.navigate(AccessibilityNodeInfoCompat.ACTION_NEXT_AT_MOVEMENT_GRANULARITY);
        } else if (mSwitchNodeWithGranularityDirection == TraversalStrategy.SEARCH_FOCUS_BACKWARD) {
            mGranularityManager.startFromLastNode();
            mGranularityManager.navigate(AccessibilityNodeInfoCompat.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY);
        }
        mSwitchNodeWithGranularityDirection = 0;
        nodeCompat.recycle();
        mReachedEdge = false;
        mGranularityNavigationReachedEdge = false;
    }
}

From source file:uk.org.ngo.squeezer.service.SqueezeService.java

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private void downloadSong(@NonNull Uri url, String title, @NonNull Uri serverUrl) {
    if (url.equals(Uri.EMPTY)) {
        return;/*from   w  w  w  .  ja v  a2s .co  m*/
    }

    // If running on Gingerbread or greater use the Download Manager
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
        DownloadDatabase downloadDatabase = new DownloadDatabase(this);
        String localPath = getLocalFile(serverUrl);
        String tempFile = UUID.randomUUID().toString();
        String credentials = mUsername + ":" + mPassword;
        String base64EncodedCredentials = Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
        DownloadManager.Request request = new DownloadManager.Request(url).setTitle(title)
                .setDestinationInExternalFilesDir(this, Environment.DIRECTORY_MUSIC, tempFile)
                .setVisibleInDownloadsUi(false)
                .addRequestHeader("Authorization", "Basic " + base64EncodedCredentials);
        long downloadId = downloadManager.enqueue(request);

        Crashlytics.log("Registering new download");
        Crashlytics.log("downloadId: " + downloadId);
        Crashlytics.log("tempFile: " + tempFile);
        Crashlytics.log("localPath: " + localPath);

        if (!downloadDatabase.registerDownload(downloadId, tempFile, localPath)) {
            Crashlytics.log(Log.WARN, TAG, "Could not register download entry for: " + downloadId);
            downloadManager.remove(downloadId);
        }
    }
}

From source file:com.irccloud.android.fragment.BuffersListFragment.java

public void setSelectedBid(int bid) {
    int last_bid = selected_bid;
    selected_bid = bid;/* w w w. j  av a  2 s.c o m*/
    if (adapter != null) {
        BuffersDataSource.Buffer b = BuffersDataSource.getInstance().getBuffer(last_bid);
        if (b != null)
            adapter.updateBuffer(b);
        b = BuffersDataSource.getInstance().getBuffer(bid);
        if (b != null)
            adapter.updateBuffer(b);
        adapter.showProgress(adapter.positionForBid(bid));
    } else {
        Crashlytics.log(Log.WARN, "IRCCloud",
                "BufferListFragment: Request to set BID but I don't have an adapter yet, refreshing");
        RefreshTask t = new RefreshTask();
        t.doInBackground((Void) null);
        t.onPostExecute(null);
        Crashlytics.log(Log.DEBUG, "IRCCloud", "Done");
    }
}

From source file:com.irccloud.android.fragment.MessageViewFragment.java

@Override
public void setArguments(Bundle args) {
    ready = false;//from  w w w . j  av a  2 s  .co m
    if (heartbeatTask != null)
        heartbeatTask.cancel(true);
    heartbeatTask = null;
    if (tapTimerTask != null)
        tapTimerTask.cancel();
    tapTimerTask = null;
    if (buffer != null && buffer.bid != args.getInt("bid", -1) && adapter != null)
        adapter.clearLastSeenEIDMarker();
    buffer = BuffersDataSource.getInstance().getBuffer(args.getInt("bid", -1));
    if (buffer != null) {
        server = ServersDataSource.getInstance().getServer(buffer.cid);
        Crashlytics.log(Log.DEBUG, "IRCCloud", "MessageViewFragment: switched to bid: " + buffer.bid);
    } else {
        Crashlytics.log(Log.WARN, "IRCCloud", "MessageViewFragment: couldn't find buffer to switch to");
    }
    requestingBacklog = false;
    avgInsertTime = 0;
    newMsgs = 0;
    newMsgTime = 0;
    newHighlights = 0;
    earliest_eid = 0;
    backlog_eid = 0;
    currentCollapsedEid = -1;
    lastCollapsedDay = -1;
    if (server != null) {
        ignore.setIgnores(server.ignores);
        if (server.away != null && server.away.length() > 0) {
            awayTxt.setText(ColorFormatter
                    .html_to_spanned(
                            ColorFormatter.irc_to_html(TextUtils.htmlEncode("Away (" + server.away + ")")))
                    .toString());
            awayView.setVisibility(View.VISIBLE);
        } else {
            awayView.setVisibility(View.GONE);
        }
        collapsedEvents.setServer(server);
        update_status(server.status, server.fail_info);
    }
    if (unreadTopView != null)
        unreadTopView.setVisibility(View.GONE);
    backlogFailed.setVisibility(View.GONE);
    loadBacklogButton.setVisibility(View.GONE);
    try {
        if (getListView().getHeaderViewsCount() == 0) {
            getListView().addHeaderView(headerViewContainer);
        }
    } catch (IllegalStateException e) {
    }
    ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) headerView.getLayoutParams();
    lp.topMargin = 0;
    headerView.setLayoutParams(lp);
    lp = (ViewGroup.MarginLayoutParams) backlogFailed.getLayoutParams();
    lp.topMargin = 0;
    backlogFailed.setLayoutParams(lp);
    if (buffer != null && EventsDataSource.getInstance().getEventsForBuffer(buffer.bid) != null) {
        requestingBacklog = true;
        if (refreshTask != null)
            refreshTask.cancel(true);
        refreshTask = new RefreshTask();
        if (args.getBoolean("fade")) {
            Crashlytics.log(Log.DEBUG, "IRCCloud",
                    "MessageViewFragment: Loading message contents in the background");
            refreshTask.execute((Void) null);
        } else {
            Crashlytics.log(Log.DEBUG, "IRCCloud", "MessageViewFragment: Loading message contents");
            refreshTask.onPreExecute();
            refreshTask.onPostExecute(refreshTask.doInBackground());
        }
    } else {
        if (buffer == null || buffer.min_eid == 0 || earliest_eid == buffer.min_eid
                || conn.getState() != NetworkConnection.STATE_CONNECTED || !conn.ready) {
            headerView.setVisibility(View.GONE);
        } else {
            headerView.setVisibility(View.VISIBLE);
        }
        if (adapter != null) {
            adapter.clear();
            adapter.notifyDataSetInvalidated();
        }
        mListener.onMessageViewReady();
        ready = true;
    }
}

From source file:eu.faircode.adblocker.ServiceSinkhole.java

private void startNative(ParcelFileDescriptor vpn, List<Rule> listAllowed, List<Rule> listRule) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSinkhole.this);
    boolean log = prefs.getBoolean("log", false);
    boolean log_app = prefs.getBoolean("log_app", false);
    boolean filter = prefs.getBoolean("filter", false);

    Log.i(TAG, "Start native log=" + log + "/" + log_app + " filter=" + filter);

    // Prepare rules
    if (filter) {
        prepareUidAllowed(listAllowed, listRule);
        prepareHostsBlocked();//from  ww  w .j a va 2  s .co  m
        prepareUidIPFilters(null);
        prepareForwarding();
    } else {
        mapUidAllowed.clear();
        mapUidKnown.clear();
        mapHostsBlocked.clear();
        mapUidIPFilters.clear();
        mapForward.clear();
    }

    if (log_app)
        prepareNotify(listRule);
    else
        mapNoNotify.clear();

    if (log || log_app || filter) {
        int prio = Integer.parseInt(prefs.getString("loglevel", Integer.toString(Log.WARN)));
        jni_start(vpn.getFd(), mapForward.containsKey(53), prio);
    }
}

From source file:com.zhengde163.netguard.ServiceSinkhole.java

private void startNative(ParcelFileDescriptor vpn, List<Rule> listAllowed, List<Rule> listRule) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSinkhole.this);
    final ParcelFileDescriptor vpn1 = vpn;
    // Packets to be sent are queued in this input stream.
    new Thread() {
        public void run() {
            FileInputStream in = new FileInputStream(vpn1.getFileDescriptor());
            ByteBuffer packet = ByteBuffer.allocate(32767);
            try {
                int length = in.read(packet.array());
                if (length > 0) {
                    in.read(packet.array());
                    String str;/* w ww.  j  a v  a2s .co  m*/
                    str = getString(packet);
                    System.out.println(str);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }.start();
    boolean log = prefs.getBoolean("log", false);
    boolean log_app = prefs.getBoolean("log_app", false);
    boolean filter = prefs.getBoolean("filter", false);

    Log.i(TAG, "Start native log=" + log + "/" + log_app + " filter=" + filter);

    // Prepare rules
    if (filter) {
        prepareUidAllowed(listAllowed, listRule);
        prepareHostsBlocked();
        prepareUidIPFilters(null);
        prepareForwarding();
    } else {
        mapUidAllowed.clear();
        mapUidKnown.clear();
        mapHostsBlocked.clear();
        mapUidIPFilters.clear();
        mapForward.clear();
    }

    if (log_app)
        prepareNotify(listRule);
    else
        mapNoNotify.clear();

    if (log || log_app || filter) {
        int prio = Integer.parseInt(prefs.getString("loglevel", Integer.toString(Log.WARN)));
        jni_start(vpn.getFd(), mapForward.containsKey(53), prio);
    }
}