List of usage examples for android.util Log INFO
int INFO
To view the source code for android.util Log INFO.
Click Source Link
From source file:com.cbsb.ftpserv.ProxyConnector.java
public ProxyDataSocketInfo pasvListen() { try {//from ww w. j a va 2 s.c o m // connect to proxy and authenticate myLog.d("Sending data_pasv_listen to proxy"); Socket socket = newAuthedSocket(this.hostname, Defaults.REMOTE_PROXY_PORT); if (socket == null) { myLog.i("pasvListen got null socket"); return null; } JSONObject request = makeJsonRequest("data_pasv_listen"); JSONObject response = sendRequest(socket, request); if (response == null) { return null; } int port = response.getInt("port"); return new ProxyDataSocketInfo(socket, port); } catch (JSONException e) { myLog.l(Log.INFO, "JSONException in pasvListen"); return null; } }
From source file:layout.FragmentBoardItemList.java
private void getThreadReplies() { showProgressBar();//from w w w. j a v a 2s. c o m boardItems.clear(); setUpThreadProgess(); int limit = Integer.valueOf(settings.getString("pref_lastreplies", "1000")); int parentTotalReplies = currentThread.getTotalReplies(); // TODO: asddas String offset = "&offset=0"; if (limit <= parentTotalReplies) { offset = "&offset=" + (parentTotalReplies - limit + 1); } else { limit = 1337; } final int finalLimit = limit; Ion.with(getContext()) .load("http://bienvenidoainternet.org/cgi/api/thread?id=" + currentThread.realParentId() + "&dir=" + currentThread.getParentBoard().getBoardDir() + "&limit=" + limit + offset) .setLogging("getThreadReplies", Log.INFO).noCache().asString() .setCallback(new FutureCallback<String>() { @Override public void onCompleted(Exception e, String result) { if (e != null) { e.printStackTrace(); displayError(e.getMessage()); } else { try { JSONObject json = new JSONObject(result); JSONArray thread = json.getJSONArray("posts"); for (int i = 0; i < thread.length(); i++) { JSONObject reply = thread.getJSONObject(i); BoardItem item = new BoardItem(); item.setDeletedCode(reply.getInt("IS_DELETED")); if (item.getDeletedCode() == 0) { item.setEmail(reply.getString("email")); item.setFile(reply.getString("file")); item.setFilesize(reply.getInt("file_size")); item.setId(reply.getInt("id")); item.setName(reply.getString("name")); item.setSubject(reply.getString("subject")); item.setThumb(reply.getString("thumb")); item.setThumbHeight(reply.getInt("thumb_height")); item.setThumbWidth(reply.getInt("thumb_width")); item.setTimeStamp(reply.getLong("timestamp")); item.setParentId(json.getInt("id")); item.setLockStatus(json.getInt("locked")); item.setTripcode(reply.getString("tripcode")); item.setTimeStampFormatted(reply.getString("timestamp_formatted")); if (item.getTimeStampFormatted().contains("ID")) { item.setPosterId( item.getTimeStampFormatted().split(" ")[1].replace("ID:", "")); } item.setParentBoard(currentBoard); item.isReply = true; item.setIdColor(addReplyID(item.getPosterId())); item.setTotalReplies(json.getInt("total_replies")); if (currentBoard.getBoardType() == 1) { if (item.getTotalReplies() < finalLimit) { item.setBbsId(i + 1); } else { item.setBbsId((item.getTotalReplies() - finalLimit + i) + 2); } } item.setMessage(reply.getString("message")); } else { item.setId(reply.getInt("id")); item.setTimeStamp(reply.getLong("timestamp")); item.isReply = true; item.setTotalReplies(json.getInt("total_replies")); if (currentBoard.getBoardType() == 1) { if (item.getTotalReplies() < finalLimit) { item.setBbsId(i + 1); } else { item.setBbsId((item.getTotalReplies() - finalLimit + i) + 2); } } } boardItems.add(item); } } catch (JSONException e1) { e1.printStackTrace(); displayError(e1.getMessage()); } } listViewAdapter.notifyDataSetChanged(); listViewAdapter.updateBoardItems(boardItems); if (settings.getBoolean("setting_scrollatnewthread", true)) { listViewBoardItems.setSelection(boardItems.size()); mListener.showActionButton(); } mListener.onThread(); hideProgressBar(); } }); }
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 . j a v a 2 s . c o 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:layout.FragmentBoardItemList.java
private void getRecentPosts() { boardItems.clear();//from w w w . j av a2 s. c om loadingMoreThreads = true; setUpThreadProgess(); String limit = settings.getString("pref_lastreplies_limit", "30"); Ion.with(getContext()).load("http://bienvenidoainternet.org/cgi/api/last?limit=" + limit) .setLogging("getRecentPosts", Log.INFO).noCache().asString() .setCallback(new FutureCallback<String>() { @Override public void onCompleted(Exception e, String result) { if (e != null) { e.printStackTrace(); displayError(e.getMessage()); } else { try { JSONObject json = new JSONObject(result); JSONArray posts = json.getJSONArray("posts"); for (int i = 0; i < posts.length(); i++) { JSONObject jPost = posts.getJSONObject(i); BoardItem recentPost = new BoardItem(); recentPost.setEmail(jPost.getString("email")); recentPost.setFile(jPost.getString("file")); recentPost.setFilesize(jPost.getInt("file_size")); recentPost.setId(jPost.getInt("id")); recentPost.setName(jPost.getString("name")); recentPost.setSubject(jPost.getString("subject")); recentPost.setThumb(jPost.getString("thumb")); recentPost.setThumbHeight(jPost.getInt("thumb_height")); recentPost.setThumbWidth(jPost.getInt("thumb_width")); recentPost.setTimeStamp(jPost.getLong("timestamp")); recentPost.setTripcode(jPost.getString("tripcode")); recentPost.setTimeStampFormatted(jPost.getString("timestamp_formatted")); if (recentPost.getTimeStampFormatted().contains("ID")) { recentPost.setPosterId(recentPost.getTimeStampFormatted().split(" ")[1] .replace("ID:", "")); } recentPost.setParentBoard( ((MainActivity) getActivity()).getBoardFromDir(jPost.getString("dir"))); recentPost.setParentId(jPost.getInt("parentid")); recentPost.setMessage(jPost.getString("message")); boardItems.add(recentPost); } } catch (JSONException e1) { e1.printStackTrace(); displayError(e1.getMessage()); } } recentPostAdapter.notifyDataSetChanged(); mListener.onRecentPosts(); } }); }
From source file:layout.FragmentBoardItemList.java
private void getThumbnail(final BoardItem bi) { bi.downloadingThumb = true;//from w w w .java 2 s. c o m ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = cm.getActiveNetworkInfo(); boolean usingWifi = (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_WIFI); ContextWrapper cw = new ContextWrapper(getActivity().getApplicationContext()); File directory = cw.getDir("thumbs", Context.MODE_PRIVATE); if (!directory.exists()) { directory.mkdir(); } final File mypath; if (bi.youtubeLink) { mypath = new File(directory, currentBoard.getBoardDir() + "_" + bi.youtubeID); } else { mypath = new File(directory, currentBoard.getBoardDir() + "_" + bi.getThumb()); } if (mypath.exists()) { try { Bitmap b = BitmapFactory.decodeStream(new FileInputStream(mypath)); bi.setThumbBitmap(Bitmap.createScaledBitmap(b, 128, 128, false)); listViewAdapter.notifyDataSetChanged(); Log.i("getThumb", bi.getThumb() + " from cache"); return; } catch (Exception e) { e.printStackTrace(); displayError(e.getMessage()); } } if (settings.getBoolean("setting_downloadOnlyWithWifi", false) == true && !usingWifi) { Log.i("getThumb", "Not using wifi"); return; } String imgURL = "http://bienvenidoainternet.org/" + bi.getParentBoard().getBoardDir() + "/thumb/" + bi.getThumb(); if (bi.getThumb().startsWith("http")) { imgURL = bi.getThumb(); } Ion.with(getContext()).load(imgURL).setLogging("getThumbnail", Log.INFO).asBitmap() .setCallback(new FutureCallback<Bitmap>() { @Override public void onCompleted(Exception e, Bitmap result) { if (e != null) { displayError(e.getMessage()); e.printStackTrace(); } else { bi.setThumbBitmap(Bitmap.createScaledBitmap(result, 128, 128, false)); listViewAdapter.notifyDataSetChanged(); FileOutputStream out; try { out = new FileOutputStream(mypath); result.compress(Bitmap.CompressFormat.PNG, 100, out); if (out != null) { out.close(); } Log.v("getThumb", bi.getThumb() + " saved."); } catch (Exception e1) { e1.printStackTrace(); } } } }); }
From source file:layout.FragmentBoardItemList.java
private void deletePost(final boolean imageOnly, BoardItem reply) { String password = settings.getString("pref_password", "12345678"); Ion.with(getContext())/*from www.j a va 2 s.c o m*/ .load("http://bienvenidoainternet.org/cgi/api/delete?dir=" + currentThread.getParentBoard().getBoardDir() + "&id=" + reply.getId() + "&password=" + password + "&imageonly=" + (imageOnly ? 1 : 0)) .setLogging("deletePost", Log.INFO).asString().setCallback(new FutureCallback<String>() { @Override public void onCompleted(Exception e, String result) { if (e != null) { e.printStackTrace(); displayError(e.getMessage()); } else { JSONObject json = null; try { json = new JSONObject(result); if (json.getString("state").equals("success")) { Toast.makeText(getContext(), imageOnly ? "Imgen" : "Respuesta" + " eliminada", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getContext(), URLDecoder.decode(json.getString("message"), "UTF-8"), Toast.LENGTH_LONG).show(); } } catch (JSONException e1) { e1.printStackTrace(); displayError(e1.getMessage()); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); displayError(e1.getMessage()); } } } }); }
From source file:com.irccloud.android.NetworkConnection.java
public void schedule_idle_timer() { if (idleTimerTask != null) idleTimerTask.cancel();/* w ww . j ava 2 s .co m*/ if (idle_interval <= 0) return; try { idleTimerTask = new TimerTask() { public void run() { if (handlers.size() > 0) { Crashlytics.log(Log.INFO, TAG, "Websocket idle time exceeded, reconnecting..."); state = STATE_DISCONNECTING; notifyHandlers(EVENT_CONNECTIVITY, null); if (client != null) client.disconnect(); connect(session); } reconnect_timestamp = 0; } }; idleTimer.schedule(idleTimerTask, idle_interval); reconnect_timestamp = System.currentTimeMillis() + idle_interval; } catch (IllegalStateException e) { //It's possible for timer to get canceled by another thread before before it gets scheduled //so catch the exception } }
From source file:com.irccloud.android.ColorFormatter.java
public static void init() { if (EMOJI == null) { long start = System.currentTimeMillis(); StringBuilder sb = new StringBuilder(16384); sb.append("\\B:("); for (String key : emojiMap.keySet()) { if (sb.length() > 4) sb.append("|"); for (int i = 0; i < key.length(); i++) { char c = key.charAt(i); if (c == '-' || c == '+' || c == '(' || c == ')') sb.append('\\'); sb.append(c);/* w ww . java2s . c om*/ } } sb.append("):\\B"); EMOJI = Pattern.compile(sb.toString()); sb.setLength(0); sb.append("("); for (String key : conversionMap.keySet()) { if (sb.length() > 2) sb.append("|"); sb.append(key); } sb.append(")"); CONVERSION = Pattern.compile(sb.toString()); sb.setLength(0); sb.append("(?:"); for (String key : emojiMap.keySet()) { if (sb.length() > 2) sb.append("|"); sb.append(emojiMap.get(key)); } for (String value : conversionMap.values()) { if (sb.length() > 2) sb.append("|"); sb.append(value); } sb.append(")+"); IS_EMOJI = Pattern.compile(sb.toString().replace(":)|", "").replace("*", "\\*")); Crashlytics.log(Log.INFO, "IRCCloud", "Compiled :emocode: regex from " + emojiMap.size() + " keys in " + (System.currentTimeMillis() - start) + "ms"); } }
From source file:biz.bokhorst.xprivacy.ActivityMain.java
private void checkLicense() { if (!Util.isProEnabled() && Util.hasProLicense(this) == null) if (Util.isProEnablerInstalled(this)) try { int uid = getPackageManager().getPackageInfo("biz.bokhorst.xprivacy.pro", 0).applicationInfo.uid; PrivacyManager.deleteRestrictions(uid, null, true); Util.log(null, Log.INFO, "Licensing: check"); startActivityForResult(new Intent("biz.bokhorst.xprivacy.pro.CHECK"), ACTIVITY_LICENSE); } catch (Throwable ex) { Util.bug(null, ex); }/*from w ww.ja va2 s .c o m*/ }