Refactor package and class names

master
Piotro 2023-07-06 19:06:39 +02:00
rodzic f3099e0202
commit 47d8e33556
20 zmienionych plików z 44 dodań i 121 usunięć

Wyświetl plik

@ -1,26 +0,0 @@
package eu.piotro.sondechaser;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("eu.piotro.sondechaser", appContext.getPackageName());
}
}

Wyświetl plik

@ -13,8 +13,12 @@ import org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider;
import java.util.Date;
import java.util.Objects;
import eu.piotro.sondechaser.data.structs.Point;
import eu.piotro.sondechaser.data.structs.Sonde;
import eu.piotro.sondechaser.handlers.BlueAdapter;
import eu.piotro.sondechaser.handlers.Orientation;
import eu.piotro.sondechaser.ui.home.MapUpdater;
import eu.piotro.sondechaser.ui.slideshow.SlideshowFragment;
import eu.piotro.sondechaser.ui.compass.CompassFragment;
public class DataCollector implements Runnable {
@ -38,7 +42,7 @@ public class DataCollector implements Runnable {
private final Activity rootActivity;
private MapUpdater mapUpdater = null;
private SlideshowFragment compassUpdater = null;
private CompassFragment compassUpdater = null;
private boolean stop = false;
private BlueAdapter blueAdapter;
@ -62,7 +66,7 @@ public class DataCollector implements Runnable {
this.mapUpdater = mapUpdater;
}
public void setCompassUpdater(SlideshowFragment compassUpdater) {
public void setCompassUpdater(CompassFragment compassUpdater) {
this.compassUpdater = compassUpdater;
}

Wyświetl plik

@ -1,22 +1,16 @@
package eu.piotro.sondechaser.data;
import org.json.JSONArray;
import org.json.JSONObject;
import org.osmdroid.util.GeoPoint;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.net.ssl.HttpsURLConnection;
import eu.piotro.sondechaser.data.local.LocalServerDownloader;
import eu.piotro.sondechaser.data.local.MySondyDownloader;
import eu.piotro.sondechaser.data.local.PipeServerDownloader;
import eu.piotro.sondechaser.data.structs.Point;
import eu.piotro.sondechaser.data.structs.Sonde;
import eu.piotro.sondechaser.handlers.BlueAdapter;
public class LocalServerCollector implements Runnable {

Wyświetl plik

@ -1,7 +1,6 @@
package eu.piotro.sondechaser.data;
import android.app.Activity;
import android.view.Menu;
import android.widget.PopupMenu;
import org.json.JSONArray;
@ -26,6 +25,9 @@ import javax.net.ssl.HttpsURLConnection;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import eu.piotro.sondechaser.data.structs.Point;
import eu.piotro.sondechaser.data.structs.Sonde;
public class RadiosondyCollector implements Runnable {
private static final String BASE_URL = "https://radiosondy.info/";
private Sonde lastSonde;

Wyświetl plik

@ -6,23 +6,19 @@ import android.widget.PopupMenu;
import org.json.JSONArray;
import org.json.JSONObject;
import org.osmdroid.util.GeoPoint;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.TimeZone;
import javax.net.ssl.HttpsURLConnection;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import eu.piotro.sondechaser.data.structs.Point;
import eu.piotro.sondechaser.data.structs.Sonde;
public class SondeHubCollector implements Runnable {
private static final String BASE_URL = "https://api.v2.sondehub.org/";

Wyświetl plik

@ -1,7 +1,7 @@
package eu.piotro.sondechaser.data.local;
import eu.piotro.sondechaser.data.LocalServerCollector;
import eu.piotro.sondechaser.data.Sonde;
import eu.piotro.sondechaser.data.structs.Sonde;
public interface LocalServerDownloader {
void download();

Wyświetl plik

@ -1,13 +1,12 @@
package eu.piotro.sondechaser.data.local;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.overlay.Marker;
import java.util.Date;
import eu.piotro.sondechaser.data.BlueAdapter;
import eu.piotro.sondechaser.handlers.BlueAdapter;
import eu.piotro.sondechaser.data.LocalServerCollector;
import eu.piotro.sondechaser.data.Sonde;
import eu.piotro.sondechaser.data.structs.Sonde;
public class MySondyDownloader implements LocalServerDownloader {
private final BlueAdapter blueAdapter;

Wyświetl plik

@ -10,7 +10,7 @@ import java.net.URL;
import java.util.Date;
import eu.piotro.sondechaser.data.LocalServerCollector;
import eu.piotro.sondechaser.data.Sonde;
import eu.piotro.sondechaser.data.structs.Sonde;
import eu.piotro.sondechaser.data.SondeParser;
public class PipeServerDownloader implements LocalServerDownloader {

Wyświetl plik

@ -1,4 +1,4 @@
package eu.piotro.sondechaser.data;
package eu.piotro.sondechaser.data.structs;
import org.osmdroid.util.GeoPoint;

Wyświetl plik

@ -1,4 +1,4 @@
package eu.piotro.sondechaser.data;
package eu.piotro.sondechaser.data.structs;
import org.osmdroid.util.GeoPoint;

Wyświetl plik

@ -1,4 +1,4 @@
package eu.piotro.sondechaser.data;
package eu.piotro.sondechaser.handlers;
import android.Manifest;
import android.annotation.SuppressLint;
@ -21,7 +21,6 @@ import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
public class BlueAdapter {
private final Activity rootActivity;

Wyświetl plik

@ -1,7 +1,6 @@
package eu.piotro.sondechaser.data;
package eu.piotro.sondechaser.handlers;
import static android.content.Context.SENSOR_SERVICE;
import static androidx.core.content.ContextCompat.getSystemService;
import android.content.Context;
import android.hardware.Sensor;

Wyświetl plik

@ -1,32 +1,29 @@
package eu.piotro.sondechaser.ui.slideshow;
package eu.piotro.sondechaser.ui.compass;
import android.hardware.SensorManager;
import android.location.Location;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import org.osmdroid.util.GeoPoint;
import java.text.DecimalFormat;
import eu.piotro.sondechaser.MainActivity;
import eu.piotro.sondechaser.databinding.FragmentSlideshowBinding;
import eu.piotro.sondechaser.databinding.FragmentCompassBinding;
public class SlideshowFragment extends Fragment {
public class CompassFragment extends Fragment {
private FragmentSlideshowBinding binding;
private FragmentCompassBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
binding = FragmentSlideshowBinding.inflate(inflater, container, false);
binding = FragmentCompassBinding.inflate(inflater, container, false);
return binding.getRoot();
}

Wyświetl plik

@ -1,19 +0,0 @@
package eu.piotro.sondechaser.ui.home;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class HomeViewModel extends ViewModel {
private final MutableLiveData<String> mText;
public HomeViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is home fragment");
}
public LiveData<String> getText() {
return mText;
}
}

Wyświetl plik

@ -1,7 +1,6 @@
package eu.piotro.sondechaser.ui.home;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
@ -23,13 +22,11 @@ import java.util.Date;
import java.util.Objects;
import java.util.TimeZone;
import eu.piotro.sondechaser.MainActivity;
import eu.piotro.sondechaser.R;
import eu.piotro.sondechaser.data.ElevationApi;
import eu.piotro.sondechaser.data.LocalServerCollector;
import eu.piotro.sondechaser.data.Point;
import eu.piotro.sondechaser.data.structs.Point;
import eu.piotro.sondechaser.data.RadiosondyCollector;
import eu.piotro.sondechaser.data.Sonde;
import eu.piotro.sondechaser.data.structs.Sonde;
import eu.piotro.sondechaser.data.SondeHubCollector;
public class MapUpdater {

Wyświetl plik

@ -1,4 +1,4 @@
package eu.piotro.sondechaser.ui.gallery;
package eu.piotro.sondechaser.ui.settings;
import android.content.Context;
import android.content.SharedPreferences;
@ -18,23 +18,21 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import java.time.Duration;
import eu.piotro.sondechaser.MainActivity;
import eu.piotro.sondechaser.R;
import eu.piotro.sondechaser.data.BlueAdapter;
import eu.piotro.sondechaser.handlers.BlueAdapter;
import eu.piotro.sondechaser.data.RadiosondyCollector;
import eu.piotro.sondechaser.data.SondeHubCollector;
import eu.piotro.sondechaser.databinding.FragmentGalleryBinding;
import eu.piotro.sondechaser.databinding.FragmentSettingsBinding;
public class GalleryFragment extends Fragment {
public class SettingsFragment extends Fragment {
private FragmentGalleryBinding binding;
private FragmentSettingsBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
binding = FragmentGalleryBinding.inflate(inflater, container, false);
binding = FragmentSettingsBinding.inflate(inflater, container, false);
View root = binding.getRoot();
return root;

Wyświetl plik

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.slideshow.SlideshowFragment">
tools:context=".ui.compass.CompassFragment">
<ImageView
android:id="@+id/imageView15"
@ -220,7 +220,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/comparrow" />
app:layout_constraintTop_toTopOf="@id/complay" />
<ImageView
android:id="@+id/compcross"

Wyświetl plik

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.gallery.GalleryFragment">
tools:context=".ui.settings.SettingsFragment">
<EditText
android:id="@+id/tfrs"

Wyświetl plik

@ -13,13 +13,13 @@
<fragment
android:id="@+id/nav_gallery"
android:name="eu.piotro.sondechaser.ui.gallery.GalleryFragment"
android:name="eu.piotro.sondechaser.ui.settings.SettingsFragment"
android:label="@string/menu_gallery"
tools:layout="@layout/fragment_gallery" />
tools:layout="@layout/fragment_settings" />
<fragment
android:id="@+id/nav_slideshow"
android:name="eu.piotro.sondechaser.ui.slideshow.SlideshowFragment"
android:name="eu.piotro.sondechaser.ui.compass.CompassFragment"
android:label="@string/menu_slideshow"
tools:layout="@layout/fragment_slideshow" />
tools:layout="@layout/fragment_compass" />
</navigation>

Wyświetl plik

@ -1,17 +0,0 @@
package eu.piotro.sondechaser;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}