From 359751db77aa296d6bf63768696b1cc0fafd50d9 Mon Sep 17 00:00:00 2001 From: Artur Dryomov Date: Wed, 17 Jul 2013 04:18:31 +0300 Subject: Clean up the codebase. * Fix licenses headers and footers once again. * Fix inspection warnings. * Fix typos. * Rename resources to follow the same style everywhere. Change-Id: I3ee60f4761446322bd34323f404354096292a086 --- .../impressremote/activity/SlideShowActivity.java | 10 +++++ .../impressremote/adapter/SlidesPagerAdapter.java | 10 +++++ .../communication/BluetoothServerConnection.java | 2 +- .../communication/BluetoothServersFinder.java | 2 +- .../communication/CommandsTransmitter.java | 2 +- .../communication/CommunicationService.java | 5 --- .../communication/MessagesListener.java | 2 +- .../communication/MessagesReceiver.java | 6 +-- .../communication/PairingProvider.java | 16 +++++-- .../impressremote/communication/Protocol.java | 6 +-- .../impressremote/communication/Server.java | 50 ++++++---------------- .../communication/ServerConnection.java | 2 +- .../impressremote/communication/ServersFinder.java | 2 +- .../communication/ServersManager.java | 2 +- .../communication/TcpServerConnection.java | 2 +- .../communication/TcpServersFinder.java | 2 +- .../fragment/ComputerConnectionFragment.java | 6 +-- .../impressremote/fragment/ComputersFragment.java | 2 +- .../libreoffice/impressremote/util/Intents.java | 1 - .../impressremote/util/Preferences.java | 4 -- 20 files changed, 64 insertions(+), 70 deletions(-) (limited to 'android/sdremote/src/org/libreoffice/impressremote') diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java index a1c371b5b19a..87c4a94bf4b2 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java @@ -1,3 +1,11 @@ +/* -*- 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.activity; import android.os.Bundle; @@ -105,3 +113,5 @@ public class SlideShowActivity extends SherlockFragmentActivity { supportInvalidateOptionsMenu(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesPagerAdapter.java b/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesPagerAdapter.java index 658e4faa7cda..9aec981e928a 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesPagerAdapter.java +++ b/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesPagerAdapter.java @@ -1,3 +1,11 @@ +/* -*- 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.adapter; import android.content.Context; @@ -61,3 +69,5 @@ public class SlidesPagerAdapter extends PagerAdapter { return POSITION_NONE; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServerConnection.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServerConnection.java index baf75e541c4c..6ecaabe299d5 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServerConnection.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServerConnection.java @@ -17,7 +17,7 @@ import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; -public class BluetoothServerConnection implements ServerConnection { +class BluetoothServerConnection implements ServerConnection { // Standard UUID for the Serial Port Profile. // https://www.bluetooth.org/en-us/specification/assigned-numbers-overview/service-discovery private static final String STANDARD_SPP_UUID = "00001101-0000-1000-8000-00805F9B34FB"; diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java index a95573b1422d..60cf3df9d289 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java @@ -25,7 +25,7 @@ import android.support.v4.content.LocalBroadcastManager; import org.libreoffice.impressremote.util.Intents; import org.libreoffice.impressremote.communication.Server.Protocol; -public class BluetoothServersFinder extends BroadcastReceiver implements ServersFinder, Runnable { +class BluetoothServersFinder extends BroadcastReceiver implements ServersFinder, Runnable { private static final int SEARCH_DELAY_IN_MILLISECONDS = 1000 * 10; private final Context mContext; diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommandsTransmitter.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommandsTransmitter.java index 1947021f17ff..ebe417c3cf64 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommandsTransmitter.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommandsTransmitter.java @@ -59,7 +59,7 @@ public class CommandsTransmitter { public void setCurrentSlide(int slideIndex) { writeCommand(Protocol.Commands - .prepareCommand(Protocol.Commands.GOTO_SLIDE, + .prepareCommand(Protocol.Commands.GO_TO_SLIDE, Integer.toString(slideIndex))); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java index 3e92091f75c2..2e32813fbba0 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java @@ -213,11 +213,6 @@ public class CommunicationService extends Service implements Runnable, MessagesL return mSlideShow; } - @Deprecated - public void addServer(String aAddress, String aName, boolean aRemember) { - mServersManager.addTcpServer(aAddress, aName); - } - public void addServer(String aAddress, String aName) { mServersManager.addTcpServer(aAddress, aName); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesListener.java b/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesListener.java index ffad6b951b18..a8f9237a28eb 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesListener.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesListener.java @@ -8,7 +8,7 @@ */ package org.libreoffice.impressremote.communication; -public interface MessagesListener { +interface MessagesListener { public void onPinValidation(); public void onSuccessfulPairing(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesReceiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesReceiver.java index ab65dd498da2..4d226d868183 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesReceiver.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesReceiver.java @@ -19,7 +19,7 @@ import java.util.List; import android.text.TextUtils; import android.util.Base64; -public class MessagesReceiver implements Runnable { +class MessagesReceiver implements Runnable { private final BufferedReader mMessagesReader; private final MessagesListener mMessagesListener; @@ -108,7 +108,7 @@ public class MessagesReceiver implements Runnable { return; } - if (Protocol.Messages.SLIDESHOW_STARTED.equals(aMessageType)) { + if (Protocol.Messages.SLIDE_SHOW_STARTED.equals(aMessageType)) { int aSlidesCount = parseSlidesCount(aMessage, 1); int aCurrentSlideIndex = parseSlideIndex(aMessage, 2); @@ -116,7 +116,7 @@ public class MessagesReceiver implements Runnable { return; } - if (Protocol.Messages.SLIDESHOW_FINISHED.equals(aMessageType)) { + if (Protocol.Messages.SLIDE_SHOW_FINISHED.equals(aMessageType)) { mMessagesListener.onSlideShowFinish(); return; } diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/PairingProvider.java b/android/sdremote/src/org/libreoffice/impressremote/communication/PairingProvider.java index 9ab66465f15a..7329fd24d3f5 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/PairingProvider.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/PairingProvider.java @@ -1,3 +1,11 @@ +/* -*- 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.communication; import android.bluetooth.BluetoothAdapter; @@ -6,8 +14,8 @@ import android.os.Build; import org.libreoffice.impressremote.util.Preferences; -public final class PairingProvider { - private Context mContext; +final class PairingProvider { + private final Context mContext; private PairingProvider(Context aContext) { mContext = aContext; @@ -55,7 +63,7 @@ public final class PairingProvider { return new PairingProvider(aContext).getPairingDeviceName(); } - public String getPairingDeviceName() { + private String getPairingDeviceName() { if (BluetoothAdapter.getDefaultAdapter() == null) { return Build.MODEL; } @@ -67,3 +75,5 @@ public final class PairingProvider { return BluetoothAdapter.getDefaultAdapter().getName(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Protocol.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Protocol.java index c276ec99c5a6..daaeac7dcff7 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/Protocol.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Protocol.java @@ -56,8 +56,8 @@ final class Protocol { public static final String VALIDATING = "LO_SERVER_VALIDATING_PIN"; public static final String ADVERTISE = "LOREMOTE_ADVERTISE"; - public static final String SLIDESHOW_STARTED = "slideshow_started"; - public static final String SLIDESHOW_FINISHED = "slideshow_finished"; + public static final String SLIDE_SHOW_STARTED = "slideshow_started"; + public static final String SLIDE_SHOW_FINISHED = "slideshow_finished"; public static final String SLIDE_UPDATED = "slide_updated"; public static final String SLIDE_PREVIEW = "slide_preview"; public static final String SLIDE_NOTES = "slide_notes"; @@ -72,7 +72,7 @@ final class Protocol { public static final String TRANSITION_NEXT = "transition_next"; public static final String TRANSITION_PREVIOUS = "transition_previous"; - public static final String GOTO_SLIDE = "goto_slide"; + public static final String GO_TO_SLIDE = "goto_slide"; public static final String PRESENTATION_BLANK_SCREEN = "presentation_blank_screen"; public static final String PRESENTATION_RESUME = "presentation_resume"; public static final String PRESENTATION_START = "presentation_start"; diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java index a96ee4231bc7..bc11d927a207 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java @@ -21,26 +21,11 @@ public class Server implements Parcelable { private final Protocol mProtocol; private final String mAddress; private final String mName; - private final long mTimeDiscovered; - - /** - * Signifies a Server that shouldn't be automatically removed from the list. - * Used e.g. for the emulator. - */ - protected boolean mNoTimeout = false; - - protected Server(Protocol aProtocol, String aAddress, String aName, long aTimeDiscovered) { - this.mProtocol = aProtocol; - this.mAddress = aAddress; - this.mName = aName; - this.mTimeDiscovered = aTimeDiscovered; - } public Server(Protocol aProtocol, String aAddress, String aName) { this.mProtocol = aProtocol; this.mAddress = aAddress; this.mName = aName; - this.mTimeDiscovered = System.currentTimeMillis(); } public static Server newTcpInstance(String aAddress, String aName) { @@ -59,43 +44,32 @@ public class Server implements Parcelable { return mName; } - public long getTimeDiscovered() { - return mTimeDiscovered; - } - - public String toString() { - return getClass().getName() + '@' + Integer - .toHexString(hashCode()) + ":{" + mAddress + "," + mName + "}"; - } - @Override public int describeContents() { return SPECIAL_PARCELABLE_OBJECTS_BITMASK; } @Override - public void writeToParcel(Parcel parcel, int flags) { - parcel.writeString(mAddress); - parcel.writeString(mName); - parcel.writeString(mProtocol.name()); - parcel.writeLong(mTimeDiscovered); + public void writeToParcel(Parcel aParcel, int aFlags) { + aParcel.writeString(mAddress); + aParcel.writeString(mName); + aParcel.writeString(mProtocol.name()); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - public Server createFromParcel(Parcel parcel) { - return new Server(parcel); + public Server createFromParcel(Parcel aParcel) { + return new Server(aParcel); } - public Server[] newArray(int size) { - return new Server[size]; + public Server[] newArray(int aSize) { + return new Server[aSize]; } }; - private Server(Parcel parcel) { - this.mAddress = parcel.readString(); - this.mName = parcel.readString(); - this.mProtocol = Protocol.valueOf(parcel.readString()); - this.mTimeDiscovered = parcel.readLong(); + private Server(Parcel aParcel) { + this.mAddress = aParcel.readString(); + this.mName = aParcel.readString(); + this.mProtocol = Protocol.valueOf(aParcel.readString()); } } diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerConnection.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerConnection.java index fced5a0f7a91..e0bb49d40562 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerConnection.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerConnection.java @@ -11,7 +11,7 @@ package org.libreoffice.impressremote.communication; import java.io.InputStream; import java.io.OutputStream; -public interface ServerConnection { +interface ServerConnection { public InputStream buildMessagesStream(); public OutputStream buildCommandsStream(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServersFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServersFinder.java index aba82abbb466..52a31824df89 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServersFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServersFinder.java @@ -10,7 +10,7 @@ package org.libreoffice.impressremote.communication; import java.util.List; -public interface ServersFinder { +interface ServersFinder { public void startSearch(); public void stopSearch(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java index 7f209432cd65..388f48cece56 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServersManager.java @@ -19,7 +19,7 @@ import android.content.Context; import org.libreoffice.impressremote.util.Preferences; -public class ServersManager { +class ServersManager { private final Context mContext; private final ServersFinder mBluetoothServersFinder; diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServerConnection.java b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServerConnection.java index a559a506d8a7..a37d353221b7 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServerConnection.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServerConnection.java @@ -14,7 +14,7 @@ import java.io.OutputStream; import java.net.Socket; import java.net.UnknownHostException; -public class TcpServerConnection implements ServerConnection { +class TcpServerConnection implements ServerConnection { private final Socket mServerConnection; public TcpServerConnection(Server aServer) { diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java index ac0b9f10d345..9f50fc179949 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java @@ -31,7 +31,7 @@ import android.text.TextUtils; import org.libreoffice.impressremote.util.Intents; -public class TcpServersFinder implements ServersFinder, Runnable { +class TcpServersFinder implements ServersFinder, Runnable { private static final int SEARCH_DELAY_IN_SECONDS = 10; private static final int BLOCKING_TIMEOUT_IN_MILLISECONDS = 1000 * 10; diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputerConnectionFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputerConnectionFragment.java index 0f1c89ebde5a..ee9c75b4ed4c 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputerConnectionFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputerConnectionFragment.java @@ -171,7 +171,7 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv return LocalBroadcastManager.getInstance(aContext); } - public void setUpPinValidationInstructions(String aPin) { + private void setUpPinValidationInstructions(String aPin) { TextView aPinTextView = (TextView) getView().findViewById(R.id.text_pin); aPinTextView.setText(aPin); @@ -185,14 +185,14 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv aViewAnimator.setDisplayedChild(aViewAnimator.indexOfChild(aValidationLayout)); } - public void setUpPresentation() { + private void setUpPresentation() { Intent aIntent = Intents.buildSlideShowIntent(getActivity()); startActivity(aIntent); getActivity().finish(); } - public void setUpErrorMessage() { + private void setUpErrorMessage() { TextView aSecondaryMessageTextView = (TextView) getView().findViewById(R.id.text_secondary_error_message); aSecondaryMessageTextView.setText(buildSecondaryErrorMessage()); diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java index 084e27c96178..11d28964a418 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java @@ -163,7 +163,7 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo return LocalBroadcastManager.getInstance(aContext); } - public void loadComputers() { + private void loadComputers() { if (!isServiceBound()) { return; } diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java b/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java index e83496837b3f..04913457550a 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java +++ b/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java @@ -32,7 +32,6 @@ public final class Intents { public static final String CONNECTION_FAILED = "CONNECTION_FAILED"; - public static final String SLIDE_SHOW_STARTED = "SLIDE_SHOW_STARTED"; public static final String SLIDE_SHOW_RUNNING = "SLIDE_SHOW_RUNNING"; public static final String SLIDE_SHOW_STOPPED = "SLIDE_SHOW_STOPPED"; diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java b/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java index b23e3b67be7f..749d3ab36b77 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java +++ b/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java @@ -25,10 +25,6 @@ public final class Preferences { private Preferences() { } - public static boolean doContain(Context aContext, String aLocation, String aKey) { - return getPreferences(aContext, aLocation).contains(aKey); - } - private static SharedPreferences getPreferences(Context aContext, String aLocation) { return aContext.getSharedPreferences(aLocation, Context.MODE_PRIVATE); } -- cgit