From 41d60365ecbd2d2a7a030967bbbece91dd375dc5 Mon Sep 17 00:00:00 2001 From: Schoumi Date: Wed, 2 Nov 2016 17:05:47 +0100 Subject: [PATCH] Add Some comments on header of the class to help someone to know the purpose of them --- .../main/java/fr/mobdev/lpcprog/activity/MainActivity.java | 5 +++++ .../java/fr/mobdev/lpcprog/adapters/BinariesAdapter.java | 5 ++++- .../main/java/fr/mobdev/lpcprog/adapters/DeviceAdapter.java | 3 +++ .../main/java/fr/mobdev/lpcprog/adapters/PartsAdapter.java | 3 +++ .../main/java/fr/mobdev/lpcprog/adapters/ServerAdapter.java | 4 ++++ .../java/fr/mobdev/lpcprog/fragment/AddPartFragment.java | 3 +++ .../main/java/fr/mobdev/lpcprog/fragment/DeviceFragment.java | 3 +++ .../main/java/fr/mobdev/lpcprog/fragment/PartsFragment.java | 3 +++ .../java/fr/mobdev/lpcprog/fragment/ServersFragment.java | 4 ++-- .../java/fr/mobdev/lpcprog/fragment/USBListFragment.java | 3 +++ .../java/fr/mobdev/lpcprog/listener/DownloadListener.java | 4 ++++ .../main/java/fr/mobdev/lpcprog/listener/FlashListener.java | 3 +++ .../java/fr/mobdev/lpcprog/listener/NetworkListener.java | 4 +++- .../main/java/fr/mobdev/lpcprog/listener/ServerListener.java | 4 +++- .../java/fr/mobdev/lpcprog/managers/DatabaseManager.java | 3 +++ app/src/main/java/fr/mobdev/lpcprog/managers/IspManager.java | 3 +++ .../main/java/fr/mobdev/lpcprog/managers/NetworkManager.java | 3 +++ .../main/java/fr/mobdev/lpcprog/managers/UsbCommManager.java | 4 +++- app/src/main/java/fr/mobdev/lpcprog/objects/Binary.java | 3 +++ app/src/main/java/fr/mobdev/lpcprog/objects/Part.java | 3 +++ app/src/main/java/fr/mobdev/lpcprog/objects/Server.java | 3 +++ app/src/main/java/fr/mobdev/lpcprog/objects/USBDevice.java | 3 +++ 22 files changed, 70 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/fr/mobdev/lpcprog/activity/MainActivity.java b/app/src/main/java/fr/mobdev/lpcprog/activity/MainActivity.java index 39e50cf..8057343 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/activity/MainActivity.java +++ b/app/src/main/java/fr/mobdev/lpcprog/activity/MainActivity.java @@ -46,6 +46,11 @@ import fr.mobdev.lpcprog.fragment.USBListFragment; import fr.mobdev.lpcprog.listener.ServerListener; import fr.mobdev.lpcprog.objects.USBDevice; +/* + The only activity of the app. It Handle all change of fragment depending on user actions + the Menu change with fragment +*/ + public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, USBListFragment.USBInteractionListener, AddPartFragment.OnAddInteractionListener diff --git a/app/src/main/java/fr/mobdev/lpcprog/adapters/BinariesAdapter.java b/app/src/main/java/fr/mobdev/lpcprog/adapters/BinariesAdapter.java index 6745452..57e0f25 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/adapters/BinariesAdapter.java +++ b/app/src/main/java/fr/mobdev/lpcprog/adapters/BinariesAdapter.java @@ -43,7 +43,10 @@ import fr.mobdev.lpcprog.managers.IspManager; import fr.mobdev.lpcprog.managers.NetworkManager; import fr.mobdev.lpcprog.objects.Binary; import fr.mobdev.lpcprog.objects.Server; - +/* + Adapter that handle Binaries List. Binaries are in sections depending on servers. There's only + one list, the class handle sections and items in the adapter +*/ public class BinariesAdapter extends RecyclerView.Adapter { private static final int SECTION = 0; diff --git a/app/src/main/java/fr/mobdev/lpcprog/adapters/DeviceAdapter.java b/app/src/main/java/fr/mobdev/lpcprog/adapters/DeviceAdapter.java index 8fe42b3..7c76935 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/adapters/DeviceAdapter.java +++ b/app/src/main/java/fr/mobdev/lpcprog/adapters/DeviceAdapter.java @@ -30,6 +30,9 @@ import java.util.List; import fr.mobdev.lpcprog.R; import fr.mobdev.lpcprog.objects.USBDevice; +/* + Adapter use to display devices pluggued on the device through OTG +*/ public class DeviceAdapter extends RecyclerView.Adapter { private List devices; diff --git a/app/src/main/java/fr/mobdev/lpcprog/adapters/PartsAdapter.java b/app/src/main/java/fr/mobdev/lpcprog/adapters/PartsAdapter.java index ad62732..5b476f4 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/adapters/PartsAdapter.java +++ b/app/src/main/java/fr/mobdev/lpcprog/adapters/PartsAdapter.java @@ -34,6 +34,9 @@ import fr.mobdev.lpcprog.fragment.PartsFragment; import fr.mobdev.lpcprog.managers.DatabaseManager; import fr.mobdev.lpcprog.objects.Part; +/* + Adapter use to display list of µc definitions +*/ public class PartsAdapter extends RecyclerView.Adapter{ private List parts; diff --git a/app/src/main/java/fr/mobdev/lpcprog/adapters/ServerAdapter.java b/app/src/main/java/fr/mobdev/lpcprog/adapters/ServerAdapter.java index 76a2d95..52dac66 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/adapters/ServerAdapter.java +++ b/app/src/main/java/fr/mobdev/lpcprog/adapters/ServerAdapter.java @@ -34,6 +34,10 @@ import fr.mobdev.lpcprog.listener.ServerListener; import fr.mobdev.lpcprog.managers.DatabaseManager; import fr.mobdev.lpcprog.objects.Server; +/* + Adapter use to display servers in different sections +*/ + public class ServerAdapter extends RecyclerView.Adapter { private static final int SECTION = 0; diff --git a/app/src/main/java/fr/mobdev/lpcprog/fragment/AddPartFragment.java b/app/src/main/java/fr/mobdev/lpcprog/fragment/AddPartFragment.java index 475900e..261ef57 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/fragment/AddPartFragment.java +++ b/app/src/main/java/fr/mobdev/lpcprog/fragment/AddPartFragment.java @@ -36,6 +36,9 @@ import fr.mobdev.lpcprog.R; import fr.mobdev.lpcprog.managers.DatabaseManager; import fr.mobdev.lpcprog.objects.Part; +/* + Fragment that Handle add µC definitions to the Database +*/ public class AddPartFragment extends Fragment { private Part part; diff --git a/app/src/main/java/fr/mobdev/lpcprog/fragment/DeviceFragment.java b/app/src/main/java/fr/mobdev/lpcprog/fragment/DeviceFragment.java index d8ed021..3e4c708 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/fragment/DeviceFragment.java +++ b/app/src/main/java/fr/mobdev/lpcprog/fragment/DeviceFragment.java @@ -48,6 +48,9 @@ import fr.mobdev.lpcprog.objects.Server; import fr.mobdev.lpcprog.objects.USBDevice; import fr.mobdev.lpcprog.managers.UsbCommManager; +/* + Fragment that handle action on a specific device that can be flash with some Binaries +*/ public class DeviceFragment extends Fragment { private UsbCommManager comm; diff --git a/app/src/main/java/fr/mobdev/lpcprog/fragment/PartsFragment.java b/app/src/main/java/fr/mobdev/lpcprog/fragment/PartsFragment.java index f9ec848..a4e5824 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/fragment/PartsFragment.java +++ b/app/src/main/java/fr/mobdev/lpcprog/fragment/PartsFragment.java @@ -33,6 +33,9 @@ import fr.mobdev.lpcprog.adapters.PartsAdapter; import fr.mobdev.lpcprog.managers.DatabaseManager; import fr.mobdev.lpcprog.objects.Part; +/* + Fragment that display list of different µC definitions +*/ public class PartsFragment extends Fragment { private OnEditPressListener onEditListener; diff --git a/app/src/main/java/fr/mobdev/lpcprog/fragment/ServersFragment.java b/app/src/main/java/fr/mobdev/lpcprog/fragment/ServersFragment.java index bbac282..d83211b 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/fragment/ServersFragment.java +++ b/app/src/main/java/fr/mobdev/lpcprog/fragment/ServersFragment.java @@ -36,8 +36,8 @@ import fr.mobdev.lpcprog.managers.DatabaseManager; import fr.mobdev.lpcprog.objects.Server; /* - * Activity that allow user to manage the server where he want to upload his images. Server must contains a Binaries file to work with the app - */ + Fragment that allow user to manage the server where he want to upload his images. Server must contains a Binaries file to work with the app +*/ public class ServersFragment extends Fragment { private ServerListener serverListener; diff --git a/app/src/main/java/fr/mobdev/lpcprog/fragment/USBListFragment.java b/app/src/main/java/fr/mobdev/lpcprog/fragment/USBListFragment.java index f9c9621..e9816fa 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/fragment/USBListFragment.java +++ b/app/src/main/java/fr/mobdev/lpcprog/fragment/USBListFragment.java @@ -36,6 +36,9 @@ import fr.mobdev.lpcprog.R; import fr.mobdev.lpcprog.objects.USBDevice; import fr.mobdev.lpcprog.managers.UsbCommManager; +/* + Fragment use to display USB device plugged through OTG port +*/ public class USBListFragment extends Fragment { private List devices; diff --git a/app/src/main/java/fr/mobdev/lpcprog/listener/DownloadListener.java b/app/src/main/java/fr/mobdev/lpcprog/listener/DownloadListener.java index cc99823..a2c2e76 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/listener/DownloadListener.java +++ b/app/src/main/java/fr/mobdev/lpcprog/listener/DownloadListener.java @@ -23,6 +23,10 @@ import java.util.EventListener; import fr.mobdev.lpcprog.objects.Binary; import fr.mobdev.lpcprog.objects.Server; +/* + Listener that handle events during download Binary +*/ + public interface DownloadListener extends EventListener { void downloadCanceled(Server server, Binary binary); void downloadSuccessful(Server server, Binary binary); diff --git a/app/src/main/java/fr/mobdev/lpcprog/listener/FlashListener.java b/app/src/main/java/fr/mobdev/lpcprog/listener/FlashListener.java index 4cdfce8..82e8d72 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/listener/FlashListener.java +++ b/app/src/main/java/fr/mobdev/lpcprog/listener/FlashListener.java @@ -22,6 +22,9 @@ import android.widget.ImageView; import java.util.EventListener; +/* + Listener that handle ISPManager events +*/ public interface FlashListener extends EventListener{ void onStartFlash(); void onSuccess(); diff --git a/app/src/main/java/fr/mobdev/lpcprog/listener/NetworkListener.java b/app/src/main/java/fr/mobdev/lpcprog/listener/NetworkListener.java index d1a1581..ea056d2 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/listener/NetworkListener.java +++ b/app/src/main/java/fr/mobdev/lpcprog/listener/NetworkListener.java @@ -21,7 +21,9 @@ package fr.mobdev.lpcprog.listener; import java.util.EventListener; import fr.mobdev.lpcprog.objects.Server; - +/* + Listener working with the NetworkManager to handle events +*/ public interface NetworkListener extends EventListener{ void startBinaries(); void startServer(Server server); diff --git a/app/src/main/java/fr/mobdev/lpcprog/listener/ServerListener.java b/app/src/main/java/fr/mobdev/lpcprog/listener/ServerListener.java index a836725..e3b0865 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/listener/ServerListener.java +++ b/app/src/main/java/fr/mobdev/lpcprog/listener/ServerListener.java @@ -19,7 +19,9 @@ package fr.mobdev.lpcprog.listener; import java.util.EventListener; - +/* + Listener that handle server add/delete +*/ public interface ServerListener extends EventListener { void updateServerList(); } diff --git a/app/src/main/java/fr/mobdev/lpcprog/managers/DatabaseManager.java b/app/src/main/java/fr/mobdev/lpcprog/managers/DatabaseManager.java index 71998a4..75a17ed 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/managers/DatabaseManager.java +++ b/app/src/main/java/fr/mobdev/lpcprog/managers/DatabaseManager.java @@ -32,6 +32,9 @@ import fr.mobdev.lpcprog.objects.Binary; import fr.mobdev.lpcprog.objects.Part; import fr.mobdev.lpcprog.objects.Server; +/* + Singleton use to manage all database access +*/ public class DatabaseManager extends SQLiteOpenHelper { private static DatabaseManager instance; diff --git a/app/src/main/java/fr/mobdev/lpcprog/managers/IspManager.java b/app/src/main/java/fr/mobdev/lpcprog/managers/IspManager.java index 65ef901..626ef16 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/managers/IspManager.java +++ b/app/src/main/java/fr/mobdev/lpcprog/managers/IspManager.java @@ -36,6 +36,9 @@ import fr.mobdev.lpcprog.objects.Part; import fr.mobdev.lpcprog.objects.Server; import fr.mobdev.lpcprog.objects.USBDevice; +/* + Singleton that handle all ISP functions +*/ public class IspManager { //defines diff --git a/app/src/main/java/fr/mobdev/lpcprog/managers/NetworkManager.java b/app/src/main/java/fr/mobdev/lpcprog/managers/NetworkManager.java index afe8c9b..fbc9884 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/managers/NetworkManager.java +++ b/app/src/main/java/fr/mobdev/lpcprog/managers/NetworkManager.java @@ -41,6 +41,9 @@ import fr.mobdev.lpcprog.listener.NetworkListener; import fr.mobdev.lpcprog.objects.Binary; import fr.mobdev.lpcprog.objects.Server; +/* + Singleton that handle all network connection +*/ public class NetworkManager { private NetworkListener listener; diff --git a/app/src/main/java/fr/mobdev/lpcprog/managers/UsbCommManager.java b/app/src/main/java/fr/mobdev/lpcprog/managers/UsbCommManager.java index 7c60c80..b29d1aa 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/managers/UsbCommManager.java +++ b/app/src/main/java/fr/mobdev/lpcprog/managers/UsbCommManager.java @@ -26,7 +26,9 @@ import java.util.ArrayList; import java.util.List; import fr.mobdev.lpcprog.objects.USBDevice; - +/* + Manager use to manage usb devices +*/ public class UsbCommManager { private static UsbCommManager instance = null; diff --git a/app/src/main/java/fr/mobdev/lpcprog/objects/Binary.java b/app/src/main/java/fr/mobdev/lpcprog/objects/Binary.java index 0c84147..6ec44f6 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/objects/Binary.java +++ b/app/src/main/java/fr/mobdev/lpcprog/objects/Binary.java @@ -18,6 +18,9 @@ package fr.mobdev.lpcprog.objects; +/* + Object that represent a binary for the app +*/ public class Binary { public long id; public String name; diff --git a/app/src/main/java/fr/mobdev/lpcprog/objects/Part.java b/app/src/main/java/fr/mobdev/lpcprog/objects/Part.java index 8f23aaa..9682afe 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/objects/Part.java +++ b/app/src/main/java/fr/mobdev/lpcprog/objects/Part.java @@ -18,6 +18,9 @@ package fr.mobdev.lpcprog.objects; +/* + Object that represent µC definition for the app +*/ public class Part { public long id; public long part_id; diff --git a/app/src/main/java/fr/mobdev/lpcprog/objects/Server.java b/app/src/main/java/fr/mobdev/lpcprog/objects/Server.java index 820570a..6ce13eb 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/objects/Server.java +++ b/app/src/main/java/fr/mobdev/lpcprog/objects/Server.java @@ -22,6 +22,9 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; +/* + Object that represent Server for the app +*/ public class Server { public long id; public URL url; diff --git a/app/src/main/java/fr/mobdev/lpcprog/objects/USBDevice.java b/app/src/main/java/fr/mobdev/lpcprog/objects/USBDevice.java index 2ca6193..f72fe58 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/objects/USBDevice.java +++ b/app/src/main/java/fr/mobdev/lpcprog/objects/USBDevice.java @@ -20,6 +20,9 @@ package fr.mobdev.lpcprog.objects; import com.ftdi.j2xx.FT_Device; +/* + Object that represent USBDevice as seen by the app +*/ public class USBDevice { public int PID; public int VID;