Kaydet (Commit) 47f6db64 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Use android.util.Log instead of printing to System.out

Change-Id: I314066086827d283938c6f402733da3f801ad55b
üst 56f4d7dc
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.libreoffice.impressremote;
public class Globals {
public static final String TAG = "sdremote";
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -30,6 +30,7 @@ import android.content.ServiceConnection; ...@@ -30,6 +30,7 @@ import android.content.ServiceConnection;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
...@@ -252,10 +253,8 @@ public class SelectorActivity extends SherlockActivity { ...@@ -252,10 +253,8 @@ public class SelectorActivity extends SherlockActivity {
private HashMap<Server, View> mNetworkServers = new HashMap<Server, View>(); private HashMap<Server, View> mNetworkServers = new HashMap<Server, View>();
private void deleteServer(View aView) { private void deleteServer(View aView) {
Log.i(Globals.TAG, "SelectorActivity.deleteServer(" + aView + ")");
for (Entry<Server, View> aEntry : mNetworkServers.entrySet()) { for (Entry<Server, View> aEntry : mNetworkServers.entrySet()) {
System.out.println(aEntry.getKey().getName());
System.out.println(aView);
System.out.println(aEntry.getValue());
if (aEntry.getValue() == aView if (aEntry.getValue() == aView
.findViewById(R.id.selector_sub_label) .findViewById(R.id.selector_sub_label)
|| aEntry.getValue().findViewById( || aEntry.getValue().findViewById(
......
...@@ -13,11 +13,14 @@ import java.io.IOException; ...@@ -13,11 +13,14 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.UUID; import java.util.UUID;
import org.libreoffice.impressremote.Globals;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket; import android.bluetooth.BluetoothSocket;
import android.content.Intent; import android.content.Intent;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
/** /**
* Standard Network client. Connects to a server using Sockets. * Standard Network client. Connects to a server using Sockets.
...@@ -49,7 +52,7 @@ public class BluetoothClient extends Client { ...@@ -49,7 +52,7 @@ public class BluetoothClient extends Client {
mSocket = aDevice.createRfcommSocketToServiceRecord(UUID mSocket = aDevice.createRfcommSocketToServiceRecord(UUID
.fromString("00001101-0000-1000-8000-00805F9B34FB")); .fromString("00001101-0000-1000-8000-00805F9B34FB"));
mSocket.connect(); mSocket.connect();
System.out.println("Connected"); Log.i(Globals.TAG, "BluetoothClient: connected");
mInputStream = mSocket.getInputStream(); mInputStream = mSocket.getInputStream();
mReader = new BufferedReader(new InputStreamReader(mInputStream, mReader = new BufferedReader(new InputStreamReader(mInputStream,
...@@ -57,7 +60,7 @@ public class BluetoothClient extends Client { ...@@ -57,7 +60,7 @@ public class BluetoothClient extends Client {
mOutputStream = mSocket.getOutputStream(); mOutputStream = mSocket.getOutputStream();
String aTemp = mReader.readLine(); String aTemp = mReader.readLine();
System.out.println("SF:waited"); Log.i(Globals.TAG, "BluetoothClient: got line " + aTemp);
if (!aTemp.equals("LO_SERVER_SERVER_PAIRED")) { if (!aTemp.equals("LO_SERVER_SERVER_PAIRED")) {
return; return;
} }
......
...@@ -11,6 +11,7 @@ package org.libreoffice.impressremote.communication; ...@@ -11,6 +11,7 @@ package org.libreoffice.impressremote.communication;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import org.libreoffice.impressremote.Globals;
import org.libreoffice.impressremote.communication.Server.Protocol; import org.libreoffice.impressremote.communication.Server.Protocol;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
...@@ -21,6 +22,7 @@ import android.content.Intent; ...@@ -21,6 +22,7 @@ import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Handler; import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
public class BluetoothFinder { public class BluetoothFinder {
...@@ -69,9 +71,9 @@ public class BluetoothFinder { ...@@ -69,9 +71,9 @@ public class BluetoothFinder {
@Override @Override
public void onReceive(Context context, Intent aIntent) { public void onReceive(Context context, Intent aIntent) {
if (aIntent.getAction().equals(BluetoothDevice.ACTION_FOUND)) { if (aIntent.getAction().equals(BluetoothDevice.ACTION_FOUND)) {
System.out.println("Found");
BluetoothDevice aDevice = (BluetoothDevice) aIntent.getExtras() BluetoothDevice aDevice = (BluetoothDevice) aIntent.getExtras()
.get(BluetoothDevice.EXTRA_DEVICE); .get(BluetoothDevice.EXTRA_DEVICE);
Log.i(Globals.TAG, "BluetoothFinder.onReceive: found " + aDevice.getName() + " at " + aDevice.getAddress());
Server aServer = new Server(Protocol.BLUETOOTH, Server aServer = new Server(Protocol.BLUETOOTH,
aDevice.getAddress(), aDevice.getName(), aDevice.getAddress(), aDevice.getName(),
System.currentTimeMillis()); System.currentTimeMillis());
...@@ -92,8 +94,8 @@ public class BluetoothFinder { ...@@ -92,8 +94,8 @@ public class BluetoothFinder {
aHandler.postDelayed(new Runnable() { aHandler.postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
System.out.println("Looping"); // Looping, huh?
Log.i(Globals.TAG, "BluetothFinder: looping");
} }
}, 1000 * 15); }, 1000 * 15);
} }
...@@ -103,4 +105,4 @@ public class BluetoothFinder { ...@@ -103,4 +105,4 @@ public class BluetoothFinder {
}; };
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
...@@ -15,10 +15,13 @@ import java.net.Socket; ...@@ -15,10 +15,13 @@ import java.net.Socket;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Random; import java.util.Random;
import org.libreoffice.impressremote.Globals;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
/** /**
* Standard Network client. Connects to a server using Sockets. * Standard Network client. Connects to a server using Sockets.
...@@ -84,9 +87,9 @@ public class NetworkClient extends Client { ...@@ -84,9 +87,9 @@ public class NetworkClient extends Client {
while (mReader.readLine().length() != 0) { while (mReader.readLine().length() != 0) {
// Get rid of extra lines // Get rid of extra lines
System.out.println("SF: empty line"); Log.i(Globals.TAG, "NetworkClient: extra line");
} }
System.out.println("SD: empty"); Log.i(Globals.TAG, "NetworkClient: calling startListening");
startListening(); startListening();
} }
......
...@@ -17,11 +17,13 @@ import java.net.SocketException; ...@@ -17,11 +17,13 @@ import java.net.SocketException;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import org.libreoffice.impressremote.Globals;
import org.libreoffice.impressremote.communication.Server.Protocol; import org.libreoffice.impressremote.communication.Server.Protocol;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
public class ServerFinder { public class ServerFinder {
...@@ -78,7 +80,7 @@ public class ServerFinder { ...@@ -78,7 +80,7 @@ public class ServerFinder {
.getAddress().getHostAddress(), aName, .getAddress().getHostAddress(), aName,
System.currentTimeMillis()); System.currentTimeMillis());
mServerList.put(aServer.getAddress(), aServer); mServerList.put(aServer.getAddress(), aServer);
System.out.println("Contains:<<" + aName + ">>"); Log.i(Globals.TAG, "ServerFinder.listenForServer: contains " + aName);
notifyActivity(); notifyActivity();
} catch (java.net.SocketTimeoutException e) { } catch (java.net.SocketTimeoutException e) {
...@@ -161,7 +163,7 @@ public class ServerFinder { ...@@ -161,7 +163,7 @@ public class ServerFinder {
private void checkAndAddEmulator() { private void checkAndAddEmulator() {
try { try {
if (InetAddress.getByName("10.0.2.2").isReachable(100)) { if (InetAddress.getByName("10.0.2.2").isReachable(100)) {
System.out.println("NulledNot"); Log.i(Globals.TAG, "ServerFinder.checkAndAddEmulator: NulledNot, whatever that is supposed to mean");
Server aServer = new Server(Protocol.NETWORK, "10.0.2.2", Server aServer = new Server(Protocol.NETWORK, "10.0.2.2",
"Android Emulator Host", 0); "Android Emulator Host", 0);
aServer.mNoTimeout = true; aServer.mNoTimeout = true;
...@@ -185,4 +187,4 @@ public class ServerFinder { ...@@ -185,4 +187,4 @@ public class ServerFinder {
return mServerList.values(); return mServerList.values();
} }
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment