code conventions und Kommentare hinzugefügt

This commit is contained in:
m_broelemann 2021-01-07 18:11:10 +01:00
parent fba2cac39f
commit 2f58640bff
10 changed files with 65 additions and 134 deletions

View File

@ -40,17 +40,25 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED;
public class MainActivity extends AppCompatActivity {
/** permission code for the storage permisson.*/
private static final int STORAGE_PERMISSION_CODE = 42;
/** What should be displayed in navigation.*/
private AppBarConfiguration mAppBarConfiguration;
/** To use xml instead of direct inclusion.*/
private IXML xml;
/** To use delivery instead of direct inclusion.*/
private Communicator delivery;
/** Handler for the custom user configurations. **/
private ConfigurationHandler configurationHandler;
/** To use favorite instead of direct inclusion.*/
private IFAVORITES favorite;
/**
* On create method of the main activity.
* Sets various displays and start settings.
* @param savedInstanceState
*/
@Override
@ -66,14 +74,12 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_all_IOs, R.id.nav_your_IOs)
.setDrawerLayout(drawer)
R.id.nav_all_IOs, R.id.nav_your_IOs).setDrawerLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this,
R.id.nav_host_fragment);
@ -285,6 +291,10 @@ public class MainActivity extends AppCompatActivity {
}
}
/**
* paul
* @param xmlFile
*/
private void setDefaultXML(final File xmlFile) {
try {
InputStream inputStream = getAssets().open(
@ -301,6 +311,10 @@ public class MainActivity extends AppCompatActivity {
}
}
/**
* paul
* @param xmlFile
*/
private void setDefaultConfig(final File xmlFile) {
try {
InputStream inputStream = getAssets().open(

View File

@ -162,6 +162,11 @@ public class Communicator {
requestQueue.add(request);
}
/**
* paul
* @param error
* @param method
*/
private void handleError(final VolleyError error, final String method) {
if (error instanceof ServerError) {
Log.e("Communicator", "server error during " + method

View File

@ -14,11 +14,8 @@ import com.example.aped.ui.visualization.MainListViewAdapter;
public class AllIOsFragment extends Fragment {
/**
* Include the MainActivity.
*/
/** Include the MainActivity.*/
private MainActivity mainActivity;
/**
* Compiling the data and calling up the AllIOs view.
* @param inflater

View File

@ -14,9 +14,7 @@ import com.example.aped.R;
import com.example.aped.ui.visualization.MainListViewAdapter;
public class FavoriteIOsFragment extends Fragment {
/**
* Include the MainActivity.
*/
/** Include the MainActivity.*/
private MainActivity mainActivity;
/**
*Compiling the data and calling up the FavoriteIOs view.

View File

@ -14,28 +14,17 @@ import java.util.List;
public class MainListViewAdapter extends BaseAdapter {
/**
* Einbinden der MainActivity.
*/
/** Include the MainActivity.*/
private MainActivity mainActivity;
/**
* Which view was selected, 0 for all IOs, 1 for favorite IOs.
*/
/** Which view was selected, 0 for all IOs, 1 for favorite IOs.*/
private int favoriteMode;
/**
* Name of the device for the current run.
*/
/** Name of the device for the current run.*/
private String deviceName;
/**
* Image for favorite or not.
*/
/** Image for favorite or not.*/
private int favoriteImage;
/**
* List of favorites existing when opening the favorites view.
*/
/** List of favorites existing when opening the favorites view.*/
private List<String> favoritenList;
/**
* Transfer of data to MainListViewAdapter.
* @param pMainActivity
@ -65,6 +54,9 @@ public class MainListViewAdapter extends BaseAdapter {
}
/**
* This function is used to retrieve the data item associated.
* With the specified position in the data set to get the corresponding
* data of the specified location in the data collection.
* @param position
* @return
*/
@ -75,6 +67,8 @@ public class MainListViewAdapter extends BaseAdapter {
}
/**
* As for the getItemId it returns the corresponding item element ID.
* The function returns a long item position value to the adapter.
* @param position
* @return
*/

View File

@ -16,21 +16,13 @@ import java.util.ArrayList;
import java.util.List;
public class PinView {
/**
* Include the MainActivity.
*/
/** Include the MainActivity.*/
private MainActivity mainActivity;
/**
* Image for state.
*/
/** Image for state.*/
private int image;
/**
* Values of the pins.
*/
/** Values of the pins.*/
private List<String> pinValues = new ArrayList<>();
/**
* Device name.
*/
/** Device name.*/
private String deviceName;
/**
@ -44,7 +36,7 @@ public class PinView {
}
/**
* Processing of the data in nzeigetezte of the pins frequencies and
* Processing of the data in displayed texts of the pins frequencies and
* dutycycle as well as the status lamps.
* @param i
* @return view

View File

@ -1,48 +0,0 @@
package com.example.aped.utils;
import java.util.ArrayList;
import java.util.List;
/**
* implementation for the favorites interface
* does not use persistent storage!
*/
public class TestFavorites implements IFAVORITES {
/**
* Liste der favoriten.
*/
private List<String> favorites = new ArrayList<>();
/**
* @return
*/
@Override
public List<String> getFavorites() {
return favorites;
}
/**
* @param deviceName the name of the device to be added
* @return
*/
@Override
public String addFavorite(final String deviceName) {
if (!favorites.contains(deviceName)) {
favorites.add(deviceName);
}
return deviceName;
}
/**
* @param deviceName the name of the device to be removed
* @return
*/
@Override
public String removeFavorite(final String deviceName) {
if (favorites.contains(deviceName)) {
favorites.remove(deviceName);
}
return deviceName;
}
}

View File

@ -1,37 +0,0 @@
package com.example.aped.utils;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;
public class TestXML implements IXML {
/**
* @return
*/
@Override
public List<String> getDeviceNames() {
List<String> returnList = new ArrayList<>();
returnList.add("stoff");
returnList.add("schnaps");
returnList.add("whatever");
return returnList;
}
/**
* @param deviceName the name of the relevant device
* @return
*/
@Override
public Dictionary<String, Object> getPort(final String deviceName) {
Dictionary<String, Object> returnDict = new Hashtable<>();
returnDict.put("protocol", "DI");
Dictionary<String, Object> pins = new Hashtable<>();
pins.put("GPIO2", true);
pins.put("GPIO3", false);
returnDict.put("pins", pins);
return returnDict;
}
}

View File

@ -1,8 +1,20 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<item name="ic_menu_camera" type="drawable">@android:drawable/ic_menu_camera</item>
<item name="ic_menu_gallery" type="drawable">@android:drawable/ic_menu_gallery</item>
<item name="ic_menu_slideshow" type="drawable">@android:drawable/ic_menu_slideshow</item>
<item name="ic_menu_manage" type="drawable">@android:drawable/ic_menu_manage</item>
<item name="ic_menu_share" type="drawable">@android:drawable/ic_menu_share</item>
<item name="ic_menu_send" type="drawable">@android:drawable/ic_menu_send</item>
<item name="ic_menu_camera" type="drawable">
@android:drawable/ic_menu_camera
</item>
<item name="ic_menu_gallery" type="drawable">
@android:drawable/ic_menu_gallery
</item>
<item name="ic_menu_slideshow" type="drawable">
@android:drawable/ic_menu_slideshow
</item>
<item name="ic_menu_manage" type="drawable">
@android:drawable/ic_menu_manage
</item>
<item name="ic_menu_share" type="drawable">
@android:drawable/ic_menu_share
</item>
<item name="ic_menu_send" type="drawable">
@android:drawable/ic_menu_send
</item>
</resources>

View File

@ -1,6 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.APED" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.APED"
parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/red</item>
<item name="colorPrimaryVariant">@color/grey</item>
@ -10,7 +11,8 @@
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor" tools:targetApi="l">
?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
@ -19,7 +21,9 @@
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.APED.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.APED.AppBarOverlay"
parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.APED.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="Theme.APED.PopupOverlay"
parent="ThemeOverlay.AppCompat.Light" />
</resources>