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;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
......@@ -252,10 +253,8 @@ public class SelectorActivity extends SherlockActivity {
private HashMap<Server, View> mNetworkServers = new HashMap<Server, View>();
private void deleteServer(View aView) {
Log.i(Globals.TAG, "SelectorActivity.deleteServer(" + aView + ")");
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
.findViewById(R.id.selector_sub_label)
|| aEntry.getValue().findViewById(
......
......@@ -13,11 +13,14 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.util.UUID;
import org.libreoffice.impressremote.Globals;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.content.Intent;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
/**
* Standard Network client. Connects to a server using Sockets.
......@@ -49,7 +52,7 @@ public class BluetoothClient extends Client {
mSocket = aDevice.createRfcommSocketToServiceRecord(UUID
.fromString("00001101-0000-1000-8000-00805F9B34FB"));
mSocket.connect();
System.out.println("Connected");
Log.i(Globals.TAG, "BluetoothClient: connected");
mInputStream = mSocket.getInputStream();
mReader = new BufferedReader(new InputStreamReader(mInputStream,
......@@ -57,7 +60,7 @@ public class BluetoothClient extends Client {
mOutputStream = mSocket.getOutputStream();
String aTemp = mReader.readLine();
System.out.println("SF:waited");
Log.i(Globals.TAG, "BluetoothClient: got line " + aTemp);
if (!aTemp.equals("LO_SERVER_SERVER_PAIRED")) {
return;
}
......
......@@ -11,6 +11,7 @@ package org.libreoffice.impressremote.communication;
import java.util.Collection;
import java.util.HashMap;
import org.libreoffice.impressremote.Globals;
import org.libreoffice.impressremote.communication.Server.Protocol;
import android.bluetooth.BluetoothAdapter;
......@@ -21,6 +22,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
public class BluetoothFinder {
......@@ -69,9 +71,9 @@ public class BluetoothFinder {
@Override
public void onReceive(Context context, Intent aIntent) {
if (aIntent.getAction().equals(BluetoothDevice.ACTION_FOUND)) {
System.out.println("Found");
BluetoothDevice aDevice = (BluetoothDevice) aIntent.getExtras()
.get(BluetoothDevice.EXTRA_DEVICE);
Log.i(Globals.TAG, "BluetoothFinder.onReceive: found " + aDevice.getName() + " at " + aDevice.getAddress());
Server aServer = new Server(Protocol.BLUETOOTH,
aDevice.getAddress(), aDevice.getName(),
System.currentTimeMillis());
......@@ -92,8 +94,8 @@ public class BluetoothFinder {
aHandler.postDelayed(new Runnable() {
@Override
public void run() {
System.out.println("Looping");
// Looping, huh?
Log.i(Globals.TAG, "BluetothFinder: looping");
}
}, 1000 * 15);
}
......@@ -103,4 +105,4 @@ public class BluetoothFinder {
};
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -15,10 +15,13 @@ import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Random;
import org.libreoffice.impressremote.Globals;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
/**
* Standard Network client. Connects to a server using Sockets.
......@@ -84,9 +87,9 @@ public class NetworkClient extends Client {
while (mReader.readLine().length() != 0) {
// 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();
}
......
......@@ -17,11 +17,13 @@ import java.net.SocketException;
import java.util.Collection;
import java.util.HashMap;
import org.libreoffice.impressremote.Globals;
import org.libreoffice.impressremote.communication.Server.Protocol;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
public class ServerFinder {
......@@ -78,7 +80,7 @@ public class ServerFinder {
.getAddress().getHostAddress(), aName,
System.currentTimeMillis());
mServerList.put(aServer.getAddress(), aServer);
System.out.println("Contains:<<" + aName + ">>");
Log.i(Globals.TAG, "ServerFinder.listenForServer: contains " + aName);
notifyActivity();
} catch (java.net.SocketTimeoutException e) {
......@@ -161,7 +163,7 @@ public class ServerFinder {
private void checkAndAddEmulator() {
try {
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",
"Android Emulator Host", 0);
aServer.mNoTimeout = true;
......@@ -185,4 +187,4 @@ public class ServerFinder {
return mServerList.values();
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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