Rename protocol formatter class

Этот коммит содержится в:
Anton Tananaev
2015-08-12 19:17:18 +12:00
родитель 222497d6ff
Коммит 630cf8eb86
3 изменённых файлов: 6 добавлений и 6 удалений
@@ -23,7 +23,7 @@ import java.util.TimeZone;
import android.location.Location;
import android.net.Uri;
public class Protocol {
public class ProtocolFormatter {
public static String formatRequest(String address, int port, String id, Location l, double battery) {
+3 -3
Просмотреть файл
@@ -72,7 +72,7 @@ public class TraccarService extends Service {
Log.w(LOG_TAG, error);
}
clientController = new ClientController(this, address, port, Protocol.createLoginMessage(id));
clientController = new ClientController(this, address, port, ProtocolFormatter.createLoginMessage(id));
clientController.start();
positionProvider = new PositionProvider(this, provider, interval * 1000, positionListener);
@@ -123,7 +123,7 @@ public class TraccarService extends Service {
public void onPositionUpdate(Location location) {
if (location != null) {
StatusActivity.addMessage(getString(R.string.status_location_update));
clientController.setNewLocation(Protocol.createLocationMessage(extended, location, getBatteryLevel()));
clientController.setNewLocation(ProtocolFormatter.createLocationMessage(extended, location, getBatteryLevel()));
}
}
@@ -155,7 +155,7 @@ public class TraccarService extends Service {
} else if (key.equals(TraccarActivity.KEY_ID)) {
id = sharedPreferences.getString(TraccarActivity.KEY_ID, null);
clientController.setNewLogin(Protocol.createLoginMessage(id));
clientController.setNewLogin(ProtocolFormatter.createLoginMessage(id));
} else if (key.equals(TraccarActivity.KEY_PROVIDER)) {
@@ -12,7 +12,7 @@ import static org.junit.Assert.assertEquals;
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class ProtocolTest {
public class ProtocolFormatterTest {
@Test
public void testFormatRequest() throws Exception {
@@ -20,7 +20,7 @@ public class ProtocolTest {
Location location = new Location("gps");
location.setTime(0);
String url = Protocol.formatRequest("localhost", 5055, "123456789012345", location, 0);
String url = ProtocolFormatter.formatRequest("localhost", 5055, "123456789012345", location, 0);
assertEquals("http://localhost:5055?id=123456789012345&timestamp=0&lat=0.0&lon=0.0&speed=0.0&bearing=0.0&altitude=0.0&batt=0.0", url);