Java Code Examples for roboguice.util.Ln#i()
The following examples show how to use
roboguice.util.Ln#i() .
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: 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 2
Source File: Login.java From AndFChat with GNU General Public License v3.0 | 6 votes |
@Override protected void onResume() { super.onResume(); Ln.d("Resume login"); //Check version checkVersion(); notificationManager.cancel(AndFChatApplication.LED_NOTIFICATION_ID); eventManager.clear(); Ln.i("Disconnecting!"); if (connection.isConnected()) { connection.closeConnection(this); } else { sessionData.clearAll(); chatroomManager.clear(); charManager.clear(); eventManager.clear(); } }
Example 3
Source File: Login.java From AndFChat with GNU General Public License v3.0 | 6 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"); } }
Example 4
Source File: FlistWebSocketConnection.java From AndFChat with GNU General Public License v3.0 | 6 votes |
/** * Sends a message to an channel. */ public void sendMessageToChannel(Chatroom chatroom, String msg) { JSONObject data = new JSONObject(); try { data.put("channel", chatroom.getId()); data.put("character", sessionData.getCharacterName()); data.put("message", msg); sendMessage(ClientToken.MSG, data); msg = Html.toHtml(new SpannableString(msg.trim())).trim(); String[] firstcut = msg.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.getMessage(characterManager.findCharacter(sessionData.getCharacterName()), secondcut[0]); chatroomManager.addChat(chatroom, entry); } catch (JSONException e) { Ln.w("exception occurred while sending message: " + e.getMessage()); } }
Example 5
Source File: AndFChatNotification.java From AndFChat with GNU General Public License v3.0 | 6 votes |
public void updateNotification(int messages) { if (sessionData.getSessionSettings().showNotifications()) { int icon = R.drawable.ic_st_connected; String msg = context.getString(R.string.notification_connected); if (messages > 0) { icon = R.drawable.ic_st_attention; msg = context.getResources().getQuantityString(R.plurals.notification_attention, messages, messages); Ln.i(msg); startNotification(msg, icon, true, messages); if (sessionData.getSessionSettings().vibrationFeedback()) { Ln.d("New Message Vibration on!"); vibrator.vibrate(PATTERN, -1); } } else { startNotification(msg, icon, false, 0); } } }
Example 6
Source File: MemberListAdapter.java From AndFChat with GNU General Public License v3.0 | 5 votes |
public void addBookmark() { 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.addOnList(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.addBookmark(sessionData.getAccount(), sessionData.getTicket(), activeCharacter.getName()); Ln.i("Adding " + activeCharacter.getName() + " to bookmarks"); call.enqueue(callback); }
Example 7
Source File: FListLoginPopup.java From AndFChat with GNU General Public License v3.0 | 5 votes |
@Override public void onResume() { super.onResume(); try{ setError(sessionData.getDisconnectReason()); } catch (NullPointerException e) { Ln.i("No disconnect reason"); } }
Example 8
Source File: FlistWebSocketConnection.java From AndFChat with GNU General Public License v3.0 | 5 votes |
public void closeConnectionLogout(Context context) { if (!chatroomManager.getActiveChat().isSystemChat()) { Ln.d("Set chat to console"); chatroomManager.setActiveChat(chatroomManager.getChatroom(AndFChatApplication.DEBUG_CHANNEL_NAME)); } try { Ln.d("Clear friends list"); friendListAction.clearList(); } catch (NullPointerException e) {Ln.i("No friends list to clear on disconnect");} Ln.d("Disconnect!"); if (application.getConnection().isConnected()) { application.getConnection().disconnect(); } socketHandler.disconnected(); Runnable runnable = new Runnable() { @Override public void run() { eventManager.fire(ConnectionEventListener.ConnectionEventType.DISCONNECTED); } }; new Handler(Looper.getMainLooper()).postDelayed(runnable, 250); notification.disconnectNotification(); }
Example 9
Source File: ChatScreen.java From AndFChat with GNU General Public License v3.0 | 5 votes |
public void openSelection() { if (paused) { return; } try { if (!charSelectionPopup.isShowing()) { charSelectionPopup.show(getFragmentManager(), "select_fragment"); } } catch (NullPointerException e) { Ln.i("NPE on openSelection"); } }
Example 10
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 11
Source File: ChatScreen.java From AndFChat with GNU General Public License v3.0 | 5 votes |
@Override protected void onStop() { Ln.i("onStop"); super.onStop(); sessionData.setIsVisible(false); if (connection.isConnected()) { historyManager.saveHistory(); } }
Example 12
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 13
Source File: Login.java From AndFChat with GNU General Public License v3.0 | 5 votes |
public void logIn(View v) { String account = this.account.getText().toString(); String password = this.password.getText().toString(); final Intent intent = new Intent(getBaseContext(), PickChar.class); FeedbackListener loginFeedback = new FeedbackListener() { @Override public void onResponse(String response) { if (parseJson(response, intent)) { Ln.i("Successfully logged in!"); startActivity(intent); } else { this.onError(null); } } @Override public void onError(Exception ex) { if (ex == null) { Ln.i("Can't log in!"); } else { Ln.i("Can't log in! " + ex.getMessage()); } runOnUiThread(new Runnable() { @Override public void run() { errorField.setText(R.string.error_login); } }); } }; //FlistHttpClient.logIn(account, password, loginFeedback); }
Example 14
Source File: ErrorMessageHandler.java From AndFChat with GNU General Public License v3.0 | 5 votes |
@Override public void incomingMessage(ServerToken token, String msg, List<FeedbackListener> feedbackListener) throws JSONException { if (token == ServerToken.ERR) { JSONObject json = new JSONObject(msg); String message = json.getString("message"); Ln.i("ERROR: " + message); if(!message.equals("You are already in the requested channel.")) { FCharacter systemChar = characterManager.findCharacter(CharacterManager.USER_SYSTEM); ChatEntry entry = entryFactory.getError(systemChar, message); this.addChatEntryToActiveChat(entry); } } }
Example 15
Source File: AndFChatConnectionService.java From AndFChat with GNU General Public License v3.0 | 4 votes |
@Override public void onCreate() { Ln.i(getClass().getSimpleName() + " in onCreate()"); connection = new WebSocketConnection(); }
Example 16
Source File: AndFChatConnectionService.java From AndFChat with GNU General Public License v3.0 | 4 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { Ln.i(getClass().getSimpleName() + ".onStartCommand()"); return super.onStartCommand(intent, flags, startId); }
Example 17
Source File: AndFChatConnectionService.java From AndFChat with GNU General Public License v3.0 | 4 votes |
@Override public boolean onUnbind(Intent intent) { Ln.i("onUnbind!"); return super.onUnbind(intent); }
Example 18
Source File: AndFChatConnectionService.java From AndFChat with GNU General Public License v3.0 | 4 votes |
@Override public void onTaskRemoved(Intent rootIntent) { Ln.i("onTaskRemoved"); super.onTaskRemoved(rootIntent); }
Example 19
Source File: AndFChatConnectionService.java From AndFChat with GNU General Public License v3.0 | 4 votes |
@Override public void onDestroy() { Ln.i("onDestroy!"); super.onDestroy(); }
Example 20
Source File: FirstConnectionHandler.java From AndFChat with GNU General Public License v3.0 | 4 votes |
@Override public void incomingMessage(ServerToken token, String msg, List<FeedbackListener> feedbackListener) throws JSONException { connection.askForPrivateChannel(); connection.requestOfficialChannels(); Set<String> channels = sessionData.getSessionSettings().getInitialChannel(); if (channels != null) { Object[] channelObjArray = channels.toArray(); String[] channelArray = Arrays.copyOf(channelObjArray, channelObjArray.length, String[].class); for (String aChannelArray : channelArray) { Ln.i("Joining Channel " + aChannelArray); connection.joinChannel(aChannelArray); } } Set<String> privChannels = sessionData.getSessionSettings().getInitialPrivateChannel(); if (privChannels != null) { if (privChannels.isEmpty()) { Ln.i("privChannels is empty."); } else { Ln.i("privChannels isn't empty."); } Object[] privChannelObjArray = privChannels.toArray(); String[] privChannelArray = Arrays.copyOf(privChannelObjArray, privChannelObjArray.length, String[].class); for (String aPrivChannelArray : privChannelArray) { Ln.i("Joining Channel " + aPrivChannelArray); connection.joinChannel(aPrivChannelArray); } } else { Ln.i("privChannels is null"); } sessionData.setIsInChat(true); // Add Console if (chatroomManager.getChatRooms().size() == 0) { chatroomManager.addChatroom(new Chatroom(new Channel(AndFChatApplication.DEBUG_CHANNEL_NAME, Chatroom.ChatroomType.CONSOLE), 50000)); } else { for (Chatroom chatroom : chatroomManager.getChatRooms()) { // Join all previous channel but not the main one if (channels != null) { if (chatroom.isChannel() && !channels.contains(chatroom.getId())) { connection.joinChannel(chatroom.getId()); } } } } eventManager.fire(ConnectionEventListener.ConnectionEventType.CHAR_CONNECTED); // Update notification notification.updateNotification(0); }