code conventions und Kommentare hinzugefügt
This commit is contained in:
parent
fba2cac39f
commit
2f58640bff
@ -40,17 +40,25 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
|||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
/** permission code for the storage permisson.*/
|
/** permission code for the storage permisson.*/
|
||||||
private static final int STORAGE_PERMISSION_CODE = 42;
|
private static final int STORAGE_PERMISSION_CODE = 42;
|
||||||
|
|
||||||
/** What should be displayed in navigation.*/
|
/** What should be displayed in navigation.*/
|
||||||
private AppBarConfiguration mAppBarConfiguration;
|
private AppBarConfiguration mAppBarConfiguration;
|
||||||
|
|
||||||
/** To use xml instead of direct inclusion.*/
|
/** To use xml instead of direct inclusion.*/
|
||||||
private IXML xml;
|
private IXML xml;
|
||||||
|
|
||||||
/** To use delivery instead of direct inclusion.*/
|
/** To use delivery instead of direct inclusion.*/
|
||||||
private Communicator delivery;
|
private Communicator delivery;
|
||||||
|
|
||||||
/** Handler for the custom user configurations. **/
|
/** Handler for the custom user configurations. **/
|
||||||
private ConfigurationHandler configurationHandler;
|
private ConfigurationHandler configurationHandler;
|
||||||
|
|
||||||
/** To use favorite instead of direct inclusion.*/
|
/** To use favorite instead of direct inclusion.*/
|
||||||
private IFAVORITES favorite;
|
private IFAVORITES favorite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* On create method of the main activity.
|
||||||
|
* Sets various displays and start settings.
|
||||||
* @param savedInstanceState
|
* @param savedInstanceState
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -66,14 +74,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||||
NavigationView navigationView = findViewById(R.id.nav_view);
|
NavigationView navigationView = findViewById(R.id.nav_view);
|
||||||
// Passing each menu ID as a set of Ids because each
|
// Passing each menu ID as a set of Ids because each
|
||||||
// menu should be considered as top level destinations.
|
// menu should be considered as top level destinations.
|
||||||
mAppBarConfiguration = new AppBarConfiguration.Builder(
|
mAppBarConfiguration = new AppBarConfiguration.Builder(
|
||||||
R.id.nav_all_IOs, R.id.nav_your_IOs)
|
R.id.nav_all_IOs, R.id.nav_your_IOs).setDrawerLayout(drawer)
|
||||||
.setDrawerLayout(drawer)
|
|
||||||
.build();
|
.build();
|
||||||
NavController navController = Navigation.findNavController(this,
|
NavController navController = Navigation.findNavController(this,
|
||||||
R.id.nav_host_fragment);
|
R.id.nav_host_fragment);
|
||||||
@ -285,6 +291,10 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* paul
|
||||||
|
* @param xmlFile
|
||||||
|
*/
|
||||||
private void setDefaultXML(final File xmlFile) {
|
private void setDefaultXML(final File xmlFile) {
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = getAssets().open(
|
InputStream inputStream = getAssets().open(
|
||||||
@ -301,6 +311,10 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* paul
|
||||||
|
* @param xmlFile
|
||||||
|
*/
|
||||||
private void setDefaultConfig(final File xmlFile) {
|
private void setDefaultConfig(final File xmlFile) {
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = getAssets().open(
|
InputStream inputStream = getAssets().open(
|
||||||
|
@ -162,6 +162,11 @@ public class Communicator {
|
|||||||
requestQueue.add(request);
|
requestQueue.add(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* paul
|
||||||
|
* @param error
|
||||||
|
* @param method
|
||||||
|
*/
|
||||||
private void handleError(final VolleyError error, final String method) {
|
private void handleError(final VolleyError error, final String method) {
|
||||||
if (error instanceof ServerError) {
|
if (error instanceof ServerError) {
|
||||||
Log.e("Communicator", "server error during " + method
|
Log.e("Communicator", "server error during " + method
|
||||||
|
@ -14,11 +14,8 @@ import com.example.aped.ui.visualization.MainListViewAdapter;
|
|||||||
|
|
||||||
|
|
||||||
public class AllIOsFragment extends Fragment {
|
public class AllIOsFragment extends Fragment {
|
||||||
/**
|
/** Include the MainActivity.*/
|
||||||
* Include the MainActivity.
|
|
||||||
*/
|
|
||||||
private MainActivity mainActivity;
|
private MainActivity mainActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiling the data and calling up the AllIOs view.
|
* Compiling the data and calling up the AllIOs view.
|
||||||
* @param inflater
|
* @param inflater
|
||||||
|
@ -14,9 +14,7 @@ import com.example.aped.R;
|
|||||||
import com.example.aped.ui.visualization.MainListViewAdapter;
|
import com.example.aped.ui.visualization.MainListViewAdapter;
|
||||||
|
|
||||||
public class FavoriteIOsFragment extends Fragment {
|
public class FavoriteIOsFragment extends Fragment {
|
||||||
/**
|
/** Include the MainActivity.*/
|
||||||
* Include the MainActivity.
|
|
||||||
*/
|
|
||||||
private MainActivity mainActivity;
|
private MainActivity mainActivity;
|
||||||
/**
|
/**
|
||||||
*Compiling the data and calling up the FavoriteIOs view.
|
*Compiling the data and calling up the FavoriteIOs view.
|
||||||
|
@ -14,28 +14,17 @@ import java.util.List;
|
|||||||
|
|
||||||
|
|
||||||
public class MainListViewAdapter extends BaseAdapter {
|
public class MainListViewAdapter extends BaseAdapter {
|
||||||
/**
|
/** Include the MainActivity.*/
|
||||||
* Einbinden der MainActivity.
|
|
||||||
*/
|
|
||||||
private MainActivity 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;
|
private int favoriteMode;
|
||||||
/**
|
/** Name of the device for the current run.*/
|
||||||
* Name of the device for the current run.
|
|
||||||
*/
|
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
/**
|
/** Image for favorite or not.*/
|
||||||
* Image for favorite or not.
|
|
||||||
*/
|
|
||||||
private int favoriteImage;
|
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;
|
private List<String> favoritenList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer of data to MainListViewAdapter.
|
* Transfer of data to MainListViewAdapter.
|
||||||
* @param pMainActivity
|
* @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
|
* @param position
|
||||||
* @return
|
* @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
|
* @param position
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -16,21 +16,13 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PinView {
|
public class PinView {
|
||||||
/**
|
/** Include the MainActivity.*/
|
||||||
* Include the MainActivity.
|
|
||||||
*/
|
|
||||||
private MainActivity mainActivity;
|
private MainActivity mainActivity;
|
||||||
/**
|
/** Image for state.*/
|
||||||
* Image for state.
|
|
||||||
*/
|
|
||||||
private int image;
|
private int image;
|
||||||
/**
|
/** Values of the pins.*/
|
||||||
* Values of the pins.
|
|
||||||
*/
|
|
||||||
private List<String> pinValues = new ArrayList<>();
|
private List<String> pinValues = new ArrayList<>();
|
||||||
/**
|
/** Device name.*/
|
||||||
* Device name.
|
|
||||||
*/
|
|
||||||
private String deviceName;
|
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.
|
* dutycycle as well as the status lamps.
|
||||||
* @param i
|
* @param i
|
||||||
* @return view
|
* @return view
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,20 @@
|
|||||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
<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_camera" type="drawable">
|
||||||
<item name="ic_menu_gallery" type="drawable">@android:drawable/ic_menu_gallery</item>
|
@android:drawable/ic_menu_camera
|
||||||
<item name="ic_menu_slideshow" type="drawable">@android:drawable/ic_menu_slideshow</item>
|
</item>
|
||||||
<item name="ic_menu_manage" type="drawable">@android:drawable/ic_menu_manage</item>
|
<item name="ic_menu_gallery" type="drawable">
|
||||||
<item name="ic_menu_share" type="drawable">@android:drawable/ic_menu_share</item>
|
@android:drawable/ic_menu_gallery
|
||||||
<item name="ic_menu_send" type="drawable">@android:drawable/ic_menu_send</item>
|
</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>
|
</resources>
|
@ -1,6 +1,7 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Theme.APED" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
<style name="Theme.APED"
|
||||||
|
parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
<!-- Primary brand color. -->
|
<!-- Primary brand color. -->
|
||||||
<item name="colorPrimary">@color/red</item>
|
<item name="colorPrimary">@color/red</item>
|
||||||
<item name="colorPrimaryVariant">@color/grey</item>
|
<item name="colorPrimaryVariant">@color/grey</item>
|
||||||
@ -10,7 +11,8 @@
|
|||||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
<item name="colorOnSecondary">@color/black</item>
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
<!-- Status bar color. -->
|
<!-- 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. -->
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -19,7 +21,9 @@
|
|||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</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>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user