roboguice.util.Ln Java Examples
The following examples show how to use
roboguice.util.Ln.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CallerIDApplication.java From callerid-for-android with GNU General Public License v3.0 | 6 votes |
@Override public void onCreate() { if (isDebugMode()) { try { final Class<?> strictMode = Class.forName("android.os.StrictMode"); final Method enableDefaults = strictMode.getMethod("enableDefaults"); enableDefaults.invoke(null); } catch (Exception e) { //The version of Android we're on doesn't have android.os.StrictMode //so ignore this exception Ln.d(e, "Strict mode not available"); } } //enable the http response cache in a thread to avoid a strict mode violation new Thread(){ @Override public void run() { enableHttpResponseCache(); } }.start(); }
Example #2
Source File: Core.java From oversec with GNU General Public License v3.0 | 6 votes |
private void bringUpSkb_UI() { checkUiThread(); OversecAccessibilityService aOversecAccessibilityService = mOversecAccessibilityService; if (aOversecAccessibilityService != null) { aOversecAccessibilityService.performActionOnFocusedNode(new OversecAccessibilityService.PerformFocusedNodeAction() { @Override public void performAction(final AccessibilityNodeInfo node) { bringUpSkb(node); } @Override public void performActionWhenNothingFocused() { Ln.w("No focused node found!"); } }); } }
Example #3
Source File: GeocoderHelperProvider.java From callerid-for-android with GNU General Public License v3.0 | 6 votes |
public Geocoder get() { //Only use the built in (aka Android) geocoder if it is present //Otherwise, use the Nominatim geocoder (from OpenStreetMaps) //the GeoCoder.isPresent() method exists only starting with API 9, //so use reflection to check it Class<android.location.Geocoder> geocoderClass = android.location.Geocoder.class; try { Method method = geocoderClass.getMethod("isPresent"); Boolean isPresent = (Boolean) method.invoke(null, (Object[])null); if(isPresent){ AndroidGeocoder ret = new AndroidGeocoder(application); injector.injectMembers(ret); return ret; } } catch (Exception e) { Ln.d(e, "falling back to Nominatim geocoder"); //ignore the exception - we'll just fall back to our geocoder } return nominatimGeocoder; }
Example #4
Source File: FlistWebSocketConnection.java From AndFChat with GNU General Public License v3.0 | 6 votes |
public void dice(Chatroom activeChat, String value) { JSONObject data = new JSONObject(); try { if(activeChat.isPrivateChat()) { data.put("recipient", activeChat.getName()); } else { data.put("channel", activeChat.getId()); } if (value == null || value.length() == 0) { value = "1d10"; } data.put("dice", value); sendMessage(ClientToken.RLL, data); } catch (JSONException e) { Ln.w("exception occurred while rolling: " + e.getMessage()); } }
Example #5
Source File: ChatroomManager.java From AndFChat with GNU General Public License v3.0 | 6 votes |
public void addChat(Chatroom chatroom, ChatEntry entry) { if (chatroom == null) { Ln.e("Cant find chatroom, is null"); return; } else if (entry == null) { Ln.e("Cant find entry, is null"); return; } chatroom.addChat(entry); eventManager.fire(entry, chatroom); entry.setOwned(sessionData.isUser(entry.getOwner())); if (!chatroom.hasNewMessage() && !isActiveChat(chatroom)) { chatroom.setHasNewMessage(true); eventManager.fire(chatroom, ChatroomEventType.NEW_MESSAGE); } }
Example #6
Source File: Core.java From oversec with GNU General Public License v3.0 | 6 votes |
private void showEncryptionParamsActivity_UI(final boolean imeWasVisible, final View view) { checkUiThread(); OversecAccessibilityService aOversecAccessibilityService = mOversecAccessibilityService; if (aOversecAccessibilityService != null) { aOversecAccessibilityService.performActionOnFocusedNode(new OversecAccessibilityService.PerformFocusedNodeAction() { @Override public void performAction(final AccessibilityNodeInfo node) { removeOverlayDecrypt_UI(false); EncryptionParamsActivity.show(mCtx, mUiThreadVars.getCurrentPackageName(), getNodeText(node), node.hashCode(), imeWasVisible, view); } @Override public void performActionWhenNothingFocused() { Ln.w("No focused node found!"); } }); } }
Example #7
Source File: PickChar.java From AndFChat with GNU General Public License v3.0 | 6 votes |
@Override protected void onResume() { super.onResume(); Ln.d("onResume"); // On return via back button the connection occurs to be still disconnecting, so wait a second. Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Ln.d("Checking connection"); // Connect websocket if (!connection.isConnected()) { Ln.d("Connecting..."); connection.connect(); } } }, 2000); }
Example #8
Source File: LoaderImageView.java From callerid-for-android with GNU General Public License v3.0 | 6 votes |
public boolean handleMessage(Message msg) { Ln.v("Message is: %s", msg.what); switch (msg.what) { case COMPLETE: mImage.setImageDrawable(mDrawable); mImage.setVisibility(View.VISIBLE); mSpinner.setVisibility(View.GONE); break; case FAILED: if(errorResource == null){ mImage.setVisibility(View.GONE); }else{ mImage.setImageResource(errorResource); mImage.setVisibility(View.VISIBLE); } mSpinner.setVisibility(View.GONE); break; case SPIN: mImage.setVisibility(View.GONE); mSpinner.setVisibility(View.VISIBLE); break; } //the image could be of any dimensions. Set the dimensions of the image to the same dimensions as the LoaderImageView so the LoaderImageView doesn't suddenly drastically grow/shrink when the image loads. mImage.setLayoutParams(new LayoutParams(getMeasuredWidth(), getMeasuredHeight())); return true; }
Example #9
Source File: Core.java From oversec with GNU General Public License v3.0 | 6 votes |
private void clickNodeById(final int nodeId) { //try to click the node, this at least required for skype! mOversecAccessibilityService.performNodeAction(new OversecAccessibilityService.PerformNodeAction() { boolean mFound = false; @Override public void onNodeScanned(AccessibilityNodeInfo node) { if (node.hashCode() == nodeId) { mFound = true; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { node.performAction(AccessibilityNodeInfo.ACTION_CLICK); } } } @Override public void onScrapeComplete() { if (!mFound) { Ln.w("Tried to click node %s but couldn't find it!", nodeId); } } }); }
Example #10
Source File: RoomModeHandler.java From AndFChat with GNU General Public License v3.0 | 6 votes |
@Override public void incomingMessage(ServerToken token, String msg, List<FeedbackListener> feedbackListener) throws JSONException { if (token == ServerToken.RMO) { JSONObject json = new JSONObject(msg); String channel = json.getString("channel"); String mode = json.getString("mode"); Chatroom chatroom = chatroomManager.getChatroom(channel); if (chatroom != null) { ChatEntry entry = entryFactory.getNotation(characterManager.findCharacter(CharacterManager.USER_SYSTEM), R.string.handler_message_room_mode, new Object[]{mode}); chatroomManager.addMessage(chatroom, entry); } else { Ln.e("Room mode information is for a unknown channel: " + channel); } } }
Example #11
Source File: ChatroomManager.java From AndFChat with GNU General Public License v3.0 | 6 votes |
public void addMessage(Chatroom chatroom, ChatEntry entry) { if (chatroom == null) { Ln.e("Cant find chatroom, is null"); return; } else if (entry == null) { Ln.e("Cant find entry, is null"); return; } chatroom.addMessage(entry); eventManager.fire(entry, chatroom); entry.setOwned(sessionData.isUser(entry.getOwner())); if (!chatroom.hasNewMessage() && !isActiveChat(chatroom)) { chatroom.setHasNewMessage(true); eventManager.fire(chatroom, ChatroomEventType.NEW_MESSAGE); } }
Example #12
Source File: FlistWebSocketConnection.java From AndFChat with GNU General Public License v3.0 | 6 votes |
/** * Sends a message to an channel. */ public void sendAdToChannel(Chatroom chatroom, String adMessage) { JSONObject data = new JSONObject(); try { data.put("channel", chatroom.getId()); data.put("message", adMessage); sendMessage(ClientToken.LRP, data); adMessage = Html.toHtml(new SpannableString(adMessage.trim())).trim(); String[] firstcut = adMessage.split(">", 2); int i = firstcut[1].lastIndexOf("<"); String[] secondcut = {firstcut[1].substring(0, i), firstcut[1].substring(i)}; Ln.i(secondcut[0]); ChatEntry entry = entryFactory.getAd(characterManager.findCharacter(sessionData.getCharacterName()), secondcut[0]); chatroomManager.addMessage(chatroom, entry); } catch (JSONException e) { Ln.w("exception occurred while sending message: " + e.getMessage()); } }
Example #13
Source File: RecentCallsFragment.java From callerid-for-android with GNU General Public License v3.0 | 6 votes |
@Override protected void onException(Exception e) throws RuntimeException { if (e instanceof CallerIDLookup.NoResultException) { if(offlineGeocoderResult == null){ line1View.setText(lookupNoResult); }else{ // We're already displaying the offline geolocation results... so just leave that there. } } else { Ln.e(e); if(offlineGeocoderResult == null){ line1View.setText(lookupError); }else{ // We're already displaying the offline geolocation results... so just leave that there. } } labelView.setText(""); }
Example #14
Source File: IabUtil.java From oversec with GNU General Public License v3.0 | 6 votes |
public void consumeAll(final Runnable runnable) { try { if (mInventory != null) { mIabHelper.consumeAsync(mInventory.getAllPurchases(), new IabHelper.OnConsumeMultiFinishedListener() { @Override public void onConsumeMultiFinished(List<Purchase> purchases, List<IabResult> results) { Ln.d("IAB ALL CONSUMED!"); runnable.run(); } }); } } catch (IllegalStateException ex) { ex.printStackTrace(); } }
Example #15
Source File: DemotionHandler.java From AndFChat with GNU General Public License v3.0 | 6 votes |
@Override public void incomingMessage(ServerToken token, String msg, List<FeedbackListener> feedbackListener) throws JSONException { if (token == ServerToken.COR) { JSONObject json = new JSONObject(msg); String channel = json.getString("channel"); String character = json.getString("character"); Chatroom chatroom = chatroomManager.getChatroom(channel); if (chatroom != null) { ChatEntry entry = entryFactory.getNotation(characterManager.findCharacter(character), R.string.handler_message_demoted, new Object[]{chatroom.getName()}); this.addChatEntryToActiveChat(entry); } else { Ln.e("Demotion is for a unknown channel: " + channel); } } }
Example #16
Source File: Db.java From oversec with GNU General Public License v3.0 | 6 votes |
private synchronized void setIntValue(String col, String packagename, int value) { if (packagename == null) { Ln.w("got null packagename, ignoring this call"); return; } PackageCache packageCache = getOrCreatePackageCache(packagename); Integer curValue = packageCache.mIntCache.get(col); if (curValue == null || curValue != value) { ContentValues values = new ContentValues(); values.put(COL_NAME, packagename); values.put(col, value); int r = mDb.update(TABLE_PACKAGES, values, COL_NAME + "=?", new String[]{packagename}); if (r == 0) { mDb.insert(TABLE_PACKAGES, null, values); } } packageCache.mIntCache.put(col, value); }
Example #17
Source File: VariableHandler.java From AndFChat with GNU General Public License v3.0 | 6 votes |
@Override public void incomingMessage(ServerToken token, String msg, List<FeedbackListener> feedbackListener) throws JSONException { if (token == ServerToken.VAR) { JSONObject data = new JSONObject(msg); String variableName = data.getString("variable"); Variable variable; try { variable = Variable.valueOf(variableName); } catch(IllegalArgumentException e) { Ln.e("Can't parse variable enum for '"+variableName+"' - skipping!"); return; } if (variable.getType() == Integer.class) { sessionData.setVariable(variable, data.getInt("value")); } } }
Example #18
Source File: CallerIDApplication.java From callerid-for-android with GNU General Public License v3.0 | 6 votes |
private void enableHttpResponseCache() { final long httpCacheSize = 10 * 1024 * 1024; // 10 MiB final File httpCacheDir = new File(getCacheDir(), "http"); if (Integer.parseInt(Build.VERSION.SDK) >= 18) { // com.squareup.okhttp is at least API 18 // So if we're on that or later, then the bundled Android implementation try { Class.forName("android.net.http.HttpResponseCache") .getMethod("install", File.class, long.class) .invoke(null, httpCacheDir, httpCacheSize); } catch (Exception httpResponseCacheNotAvailable) { Ln.d(httpResponseCacheNotAvailable, "android.net.http.HttpResponseCache failed to install. Using okhttp."); installHttpHandler(httpCacheSize, httpCacheDir); } }else{ // we're running on a version of Android before Jelly Bean, so // com.integralblue.httpresponsecache.HttpResponseCache is always superior. installHttpHandler(httpCacheSize, httpCacheDir); } }
Example #19
Source File: SimpleSymmetricEncryptionParamsFragment.java From oversec with GNU General Public License v3.0 | 6 votes |
@Override public void saveState(Bundle b) { try { List<Long> keyIds = mKeysAdapter == null ? Collections.synchronizedList(new ArrayList<Long>()) : mKeysAdapter.getSelectedKeyIds(); long[] a = new long[keyIds.size()]; int i = 0; synchronized (keyIds) { for (Long id : keyIds) { a[i] = id; i++; } } b.putLongArray(EXTRA_SELECTED_KEY_IDS, a); b.putInt(EXTRA_PADDER_POS, mSpPaddingSym.getSelectedItemPosition()); } catch (Exception ex) { Ln.e(ex, "error saving state!"); } }
Example #20
Source File: SymmetricEncryptionParamsFragment.java From oversec with GNU General Public License v3.0 | 6 votes |
@Override public void saveState(Bundle b) { try { List<Long> keyIds = mKeysAdapter.getSelectedKeyIds(); long[] a = new long[keyIds.size()]; int i = 0; for (Long id : keyIds) { a[i] = id; i++; } b.putLongArray(EXTRA_SELECTED_KEY_IDS, a); b.putInt(EXTRA_PADDER_POS, mSpPaddingSym.getSelectedItemPosition()); } catch (Exception ex) { Ln.e(ex, "error saving state!"); } }
Example #21
Source File: FlistWebSocketConnection.java From AndFChat with GNU General Public License v3.0 | 6 votes |
/** * Asks the server to leave an channel */ public void leaveChannel(Chatroom chatroom) { // TODO: Leave private chat without deleting "log" if (!chatroom.isPrivateChat()) { JSONObject data = new JSONObject(); try { data.put("channel", chatroom.getChannel().getChannelId()); sendMessage(ClientToken.LCH, data); } catch (JSONException e) { Ln.w("exception occurred while leaving channel: " + e.getMessage()); } } else { // Private chats will just be removed. boolean wasActive = chatroomManager.isActiveChat(chatroom); chatroomManager.removeChatroom(chatroom.getChannel()); eventManager.fire(chatroom, ChatroomEventType.LEFT); if (wasActive) { List<Chatroom> chatrooms = chatroomManager.getChatRooms(); chatroomManager.setActiveChat(chatrooms.get(chatrooms.size() - 1)); } } }
Example #22
Source File: Tree.java From oversec with GNU General Public License v3.0 | 6 votes |
public CharSequence getFirstEncodedChildText() { if (sealed) { Ln.w("getFirstEncodedChildText : SEALED!"); return null; } try { for (TreeNode cn : mChildren) { if (cn.mTextString != null) { Outer.Msg cs = CryptoHandlerFacade.Companion.getEncodedData(mCtx, cn.mTextString); if (cs != null) { return cn.mText; } } CharSequence xx = cn.getFirstEncodedChildText(); if (xx != null) { return xx; } } } catch (Exception ex) { //not really well tested in terms of concurrency, so for now just catch all! Ln.w(ex); } return null; }
Example #23
Source File: OversecAccessibilityService.java From oversec with GNU General Public License v3.0 | 6 votes |
public void setMonitorEventTypesAll() { Ln.d("SERVICE: setMonitorEventTypesAll"); int mask = AccessibilityEvent.TYPE_WINDOWS_CHANGED | AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED | AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED | AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED | AccessibilityEvent.TYPE_VIEW_SCROLLED; String packagename = mCore.getCurrentPackageName(); if (packagename == null || mDb.isShowInfoOnTap(packagename)) { Ln.d("SERVICE: setMonitorEventTypesAll adding TYPE_VIEW_CLICKED"); mask |= AccessibilityEvent.TYPE_VIEW_CLICKED; } if (packagename == null || mDb.isShowInfoOnLongTap(packagename) || mDb.isToggleEncryptButtonOnLongTap(packagename)) { Ln.d("SERVICE: setMonitorEventTypesAll adding TYPE_VIEW_LONG_CLICKED"); mask |= AccessibilityEvent.TYPE_VIEW_LONG_CLICKED; } boolean includeNotImportantViews = packagename == null ? true : mDb.isIncludeNonImportantViews(packagename); setMonitorEventTypes(mask, includeNotImportantViews, true); }
Example #24
Source File: ChatScreen.java From AndFChat with GNU General Public License v3.0 | 5 votes |
public void openLogin() { if (paused) { return; } if (sessionData.getTicket() == null) { try { if (!loginPopup.isShowing()) { loginPopup.show(getFragmentManager(), "login_fragment"); //loginPopup.show(getSupportFragmentManager(),"login_fragment"); } } catch (NullPointerException e) { Ln.i("NPE on openLogin"); } } else { connection.connect(); Runnable runnable = new Runnable() { @Override public void run() { if (connection.isConnected()) { openSelection(); } else { sessionData.setTicket(null); openLogin(); } } }; new Handler(Looper.getMainLooper()).postDelayed(runnable, 1000); } }
Example #25
Source File: FlistWebSocketConnection.java From AndFChat with GNU General Public License v3.0 | 5 votes |
public void createPrivateChannel(String channelname) { JSONObject data = new JSONObject(); try { data.put("channel", channelname); sendMessage(ClientToken.CCR, data); } catch (JSONException e) { Ln.w("exception occurred while creating a private channel: " + e.getMessage()); } }
Example #26
Source File: MemberListAdapter.java From AndFChat with GNU General Public License v3.0 | 5 votes |
public void removeBookmark() { OkHttpClient client = new OkHttpClient(); //client.setProtocols(Collections.singletonList(Protocol.HTTP_1_1)); Retrofit restAdapter = new Retrofit.Builder() .baseUrl("https://www.f-list.net") .client(client) .addConverterFactory(GsonConverterFactory.create()) .build(); FlistHttpClient httpClient = restAdapter.create(FlistHttpClient.class); // HTTP call need to be a post and post wants a callback, that is not needed -> ignore retrofit2.Callback<Object> callback = new retrofit2.Callback<Object>() { @Override public void onResponse(Response<Object> response) { if (response.body() != null) { relationManager.removeFromList(CharRelation.BOOKMARKED, activeCharacter); sortList(); } else { onError("null response."); } } @Override public void onFailure(Throwable t) { onError(t.getMessage()); } private void onError(final String message) { Ln.i("Bookmarking failed: " + message); } }; Call<Object> call = httpClient.removeBookmark(sessionData.getAccount(), sessionData.getTicket(), activeCharacter.getName()); Ln.i("Removing " + activeCharacter.getName() + " from bookmarks"); call.enqueue(callback); }
Example #27
Source File: FlistWebSocketHandler.java From AndFChat with GNU General Public License v3.0 | 5 votes |
@Override public void onTextMessage(String payload) { if (!disconnected) { if (sessionData.getSessionSettings().useDebugChannel()) { FCharacter systemChar = characterManager.findCharacter(CharacterManager.USER_SYSTEM_INPUT); ChatEntry entry = new MessageEntry(systemChar, payload); Chatroom chatroom = chatroomManager.getChatroom(AndFChatApplication.DEBUG_CHANNEL_NAME); chatroomManager.addMessage(chatroom, entry); } ServerToken token; try { token = ServerToken.valueOf(payload.substring(0, 3)); Ln.v("Incoming message with token: " + token.name()); } catch (IllegalArgumentException e) { Ln.w("Can't find token '" + payload.substring(0, 3) + "' in ServerToken-Enum! -> Ignoring Message"); return; } if (handlerMap.containsKey(token)) { try { // If the message has message, give them to handler without token. // FeedbackListener will only be called once and removed. if (payload.length() > 3) { handlerMap.get(token).incomingMessage(token, payload.substring(4), feedbackListenerMap.remove(token)); } else { handlerMap.get(token).incomingMessage(token, "", feedbackListenerMap.remove(token)); } } catch (JSONException ex) { Ln.e("Can't parse json: " + payload); } } else { Ln.e("Can't find handler for token '" + token + "' -> Ignoring Message"); } } }
Example #28
Source File: ChatScreen.java From AndFChat with GNU General Public License v3.0 | 5 votes |
private void checkVersion() { Version version = sessionData.getSessionSettings().getVersion(); if (version.isLowerThan("0.2.2")) { Ln.i("Updating to version 0.2.2"); historyManager.clearHistory(true); sessionData.getSessionSettings().setVersion("0.2.2"); } if (version.isLowerThan("0.2.3")) { Ln.i("Updating to version 0.2.3"); historyManager.clearHistory(true); sessionData.getSessionSettings().setVersion("0.2.3"); } if (version.isLowerThan("0.4.0")) { Ln.i("Updating to version 0.4.0"); sessionData.getSessionSettings().setVersion("0.4.0"); } if (version.isLowerThan("0.5.0")) { Ln.i("Updating to version 0.5.0"); historyManager.clearHistory(true); sessionData.getSessionSettings().setVersion("0.5.0"); } if (version.isLowerThan("0.6.0")) { Ln.i("Updating to version 0.6.0"); historyManager.clearHistory(true); sessionData.getSessionSettings().setVersion("0.6.0"); } }
Example #29
Source File: Tree.java From oversec with GNU General Public License v3.0 | 5 votes |
private TreeNode obtain(TreeNode from, boolean copyChildren) { TreeNode res = mPool.acquire(); if (res == null) { res = new TreeNode(); } res.sealed = false; if (Ln.isDebugEnabled()) { dumpTreeNodePool("obtain A " + super.toString()); } res.copy(from, copyChildren); return res; }
Example #30
Source File: FlistWebSocketConnection.java From AndFChat with GNU General Public License v3.0 | 5 votes |
public void unban(String username, Chatroom chatroom) { JSONObject data = new JSONObject(); try { data.put("channel", chatroom.getId()); data.put("character", username); sendMessage(ClientToken.CUB, data); } catch (JSONException e) { Ln.w("exception occurred while sending CUB: " + e.getMessage()); } }