merged remote
This commit is contained in:
commit
827669a92e
@ -31,7 +31,7 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||||
implementation 'com.google.android.material:material:1.1.0'
|
implementation 'com.google.android.material:material:1.3.0-beta01'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation 'androidx.navigation:navigation-fragment:2.2.2'
|
implementation 'androidx.navigation:navigation-fragment:2.2.2'
|
||||||
implementation 'androidx.navigation:navigation-ui:2.2.2'
|
implementation 'androidx.navigation:navigation-ui:2.2.2'
|
||||||
|
@ -40,18 +40,26 @@ 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 final int STORAGE_PERMISSION_CODE = 42;
|
private static final int STORAGE_PERMISSION_CODE = 42;
|
||||||
/** was soll angezeigt werden in Navigation.*/
|
|
||||||
|
/** What should be displayed in navigation.*/
|
||||||
private AppBarConfiguration mAppBarConfiguration;
|
private AppBarConfiguration mAppBarConfiguration;
|
||||||
/** zur Verwendung von xml anstatt der direkten Einbindung.*/
|
|
||||||
public IXML xml;
|
/** To use xml instead of direct inclusion.*/
|
||||||
/** zur Verwendung von uebergabe anstatt der direkten Einbindung.*/
|
private IXML xml;
|
||||||
public Communicator uebergabe;
|
|
||||||
|
/** To use delivery instead of direct inclusion.*/
|
||||||
|
private Communicator delivery;
|
||||||
|
|
||||||
/** Handler for the custom user configurations. **/
|
/** Handler for the custom user configurations. **/
|
||||||
public ConfigurationHandler configurationHandler;
|
private ConfigurationHandler configurationHandler;
|
||||||
/** zur Verwendung von favorite anstatt der direkten Einbindung.*/
|
|
||||||
public IFAVORITES favorite;
|
/** 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
|
* @param savedInstanceState
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -61,20 +69,18 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
ensurePermissions();
|
ensurePermissions();
|
||||||
setupConfigs();
|
setupConfigs();
|
||||||
favorite = configurationHandler;
|
favorite = configurationHandler;
|
||||||
uebergabe = new Communicator(configurationHandler.getAddress(),
|
delivery = new Communicator(configurationHandler.getAddress(),
|
||||||
configurationHandler.getPort(), this);
|
configurationHandler.getPort(), this);
|
||||||
uebergabe.downloadXML();
|
delivery.downloadXML();
|
||||||
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_plots)
|
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);
|
||||||
@ -82,13 +88,22 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
navController, mAppBarConfiguration);
|
navController, mAppBarConfiguration);
|
||||||
NavigationUI.setupWithNavController(navigationView, navController);
|
NavigationUI.setupWithNavController(navigationView, navController);
|
||||||
}
|
}
|
||||||
/** Fügt Elemente zur Aktionsleiste hinzu, wenn diese vorhanden ist.*/
|
|
||||||
|
/**
|
||||||
|
*Adds elements to the action bar if it exists.
|
||||||
|
* @param menu
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.main, menu);
|
getMenuInflater().inflate(R.menu.main, menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**Navigation einrichten.*/
|
|
||||||
|
/**
|
||||||
|
* Set up navigation.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onSupportNavigateUp() {
|
public boolean onSupportNavigateUp() {
|
||||||
NavController navController = Navigation.findNavController(this,
|
NavController navController = Navigation.findNavController(this,
|
||||||
@ -96,53 +111,46 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|
||||||
|| super.onSupportNavigateUp();
|
|| super.onSupportNavigateUp();
|
||||||
}
|
}
|
||||||
/**was soll bei click auf den jeweiligen itembutton passieren.*/
|
/**
|
||||||
|
* What should happen when clicking on the respective itembutton.
|
||||||
|
* @param item
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(final @NonNull MenuItem item) {
|
public boolean onOptionsItemSelected(final @NonNull MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.action_set_IP:
|
case R.id.action_set_IP:
|
||||||
MaterialAlertDialogBuilder alert = new
|
MaterialAlertDialogBuilder alert = new
|
||||||
MaterialAlertDialogBuilder(MainActivity.this);
|
MaterialAlertDialogBuilder(MainActivity.this);
|
||||||
//alert.setTitle(R.string.action_set_connection);
|
|
||||||
View view2 = LayoutInflater.from(MainActivity.this).inflate(R.
|
View view2 = LayoutInflater.from(MainActivity.this).inflate(R.
|
||||||
layout.alert_dialog_ip_pot_eingabe, null);
|
layout.alert_dialog_ip_pot, null);
|
||||||
EditText ipAdress = (EditText) view2.findViewById(R.id.
|
EditText ipAdress = view2.findViewById(R.id.editTextIp);
|
||||||
editTextIp);
|
|
||||||
ipAdress.setText(configurationHandler.getAddress());
|
ipAdress.setText(configurationHandler.getAddress());
|
||||||
EditText port = (EditText) view2.findViewById(R.id.
|
EditText port = view2.findViewById(R.id.editTextPort);
|
||||||
editTextPort);
|
|
||||||
port.setText(String.valueOf(configurationHandler.getPort()));
|
port.setText(String.valueOf(configurationHandler.getPort()));
|
||||||
alert.setView(view2);
|
alert.setView(view2);
|
||||||
alert.setPositiveButton("set",
|
alert.setPositiveButton("set",
|
||||||
new DialogInterface.OnClickListener() {
|
(dialog, which) -> {
|
||||||
public void onClick(final DialogInterface dialog,
|
configurationHandler.setAddress(ipAdress.getText()
|
||||||
final int which) {
|
.toString());
|
||||||
// Write your code here to execute after dialog
|
configurationHandler.setPort(Integer.parseInt(port
|
||||||
configurationHandler.setAddress(ipAdress.
|
.getText().toString()));
|
||||||
getText().toString());
|
Toast.makeText(getApplicationContext(),
|
||||||
configurationHandler.setPort(Integer.parseInt(
|
configurationHandler.getAddress()
|
||||||
port.getText().toString()));
|
+ ":" + configurationHandler.
|
||||||
Toast.makeText(getApplicationContext(),
|
getPort() + " is set",
|
||||||
configurationHandler.getAddress()
|
Toast.LENGTH_SHORT).show();
|
||||||
+ ":" + configurationHandler.
|
delivery = new Communicator(
|
||||||
getPort() + " is set",
|
configurationHandler.getAddress(),
|
||||||
Toast.LENGTH_SHORT).show();
|
configurationHandler.getPort(),
|
||||||
uebergabe = new Communicator(
|
MainActivity.this);
|
||||||
configurationHandler.getAddress(),
|
|
||||||
configurationHandler.getPort(),
|
|
||||||
MainActivity.this);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
alert.setNegativeButton("exit",
|
alert.setNegativeButton("exit",
|
||||||
new DialogInterface.OnClickListener() {
|
(dialog, which) -> {
|
||||||
public void onClick(final DialogInterface dialog,
|
Toast.makeText(getApplicationContext(),
|
||||||
final int which) {
|
"exit clicked",
|
||||||
// Write your code here to execute after dialog
|
Toast.LENGTH_SHORT).show();
|
||||||
Toast.makeText(getApplicationContext(),
|
dialog.cancel();
|
||||||
"exit clicked",
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
dialog.cancel();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
alert.show();
|
alert.show();
|
||||||
break;
|
break;
|
||||||
@ -172,13 +180,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.action_download_xml:
|
case R.id.action_download_xml:
|
||||||
uebergabe.downloadXML();
|
delivery.downloadXML();
|
||||||
Toast.makeText(this, "Downloaded .xml",
|
Toast.makeText(this, "Downloaded .xml",
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
break;
|
break;
|
||||||
case R.id.action_upload_xml:
|
case R.id.action_upload_xml:
|
||||||
try {
|
try {
|
||||||
uebergabe.uploadXML();
|
delivery.uploadXML();
|
||||||
|
Toast.makeText(this, "Upload .xml executed",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Toast.makeText(this, "Upload .xml failed",
|
Toast.makeText(this, "Upload .xml failed",
|
||||||
@ -282,6 +292,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(
|
||||||
@ -298,6 +312,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(
|
||||||
@ -314,4 +332,69 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
+ e.getMessage());
|
+ e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for favorite.
|
||||||
|
* @return favorite get.
|
||||||
|
*/
|
||||||
|
public IFAVORITES getFavorite() {
|
||||||
|
return favorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter method for favorite.
|
||||||
|
* @param pFavorite set.
|
||||||
|
*/
|
||||||
|
public void setFavorite(final IFAVORITES pFavorite) {
|
||||||
|
this.favorite = pFavorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for xml.
|
||||||
|
* @return xml get.
|
||||||
|
*/
|
||||||
|
public IXML getXml() {
|
||||||
|
return xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter method for xml.
|
||||||
|
* @param pXml set.
|
||||||
|
*/
|
||||||
|
public void setXml(final IXML pXml) {
|
||||||
|
this.xml = pXml;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for delivery.
|
||||||
|
* @return delivery get.
|
||||||
|
*/
|
||||||
|
public Communicator getDelivery() {
|
||||||
|
return delivery;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter method for delivery.
|
||||||
|
* @param pDelivery set.
|
||||||
|
*/
|
||||||
|
public void setDelivery(final Communicator pDelivery) {
|
||||||
|
this.delivery = pDelivery;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for configurationHandler.
|
||||||
|
* @return configurationHandler get.
|
||||||
|
*/
|
||||||
|
public ConfigurationHandler getConfigurationHandler() {
|
||||||
|
return configurationHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter method for configurationHandler.
|
||||||
|
* @param pConfigurationHandler set.
|
||||||
|
*/
|
||||||
|
public void setConfigurationHandler(final ConfigurationHandler
|
||||||
|
pConfigurationHandler) {
|
||||||
|
this.configurationHandler = pConfigurationHandler;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,20 +14,10 @@ import com.example.aped.ui.visualization.MainListViewAdapter;
|
|||||||
|
|
||||||
|
|
||||||
public class AllIOsFragment extends Fragment {
|
public class AllIOsFragment extends Fragment {
|
||||||
/**
|
/** Include the MainActivity.*/
|
||||||
* Einbinden der MainActivity.
|
|
||||||
*/
|
|
||||||
private MainActivity mainActivity;
|
private MainActivity mainActivity;
|
||||||
/**
|
/**
|
||||||
* Genutzt für Signallampe.
|
* Compiling the data and calling up the AllIOs view.
|
||||||
*/
|
|
||||||
private int image;
|
|
||||||
/**
|
|
||||||
* Genutzt für Favoriten icons.
|
|
||||||
*/
|
|
||||||
private int favoriteImage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param inflater
|
* @param inflater
|
||||||
* @param container
|
* @param container
|
||||||
* @param savedInstanceState
|
* @param savedInstanceState
|
||||||
@ -41,12 +31,11 @@ public class AllIOsFragment extends Fragment {
|
|||||||
this.mainActivity = (MainActivity) getActivity();
|
this.mainActivity = (MainActivity) getActivity();
|
||||||
View view = inflater.inflate(R.layout.fragment_all_ios, container,
|
View view = inflater.inflate(R.layout.fragment_all_ios, container,
|
||||||
false);
|
false);
|
||||||
ListView lv = (ListView) view.findViewById(R.id.idListView);
|
ListView lv = view.findViewById(R.id.idListView);
|
||||||
MainListViewAdapter mainListViewAdapter =
|
MainListViewAdapter mainListViewAdapter =
|
||||||
new MainListViewAdapter(mainActivity, 0);
|
new MainListViewAdapter(mainActivity, 0);
|
||||||
lv.setAdapter(mainListViewAdapter);
|
lv.setAdapter(mainListViewAdapter);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,10 @@ 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.*/
|
||||||
* Einbinden der MainActivity.
|
|
||||||
*/
|
|
||||||
private MainActivity mainActivity;
|
private MainActivity mainActivity;
|
||||||
/**
|
/**
|
||||||
*
|
*Compiling the data and calling up the FavoriteIOs view.
|
||||||
* @param inflater
|
* @param inflater
|
||||||
* @param container
|
* @param container
|
||||||
* @param savedInstanceState
|
* @param savedInstanceState
|
||||||
@ -27,15 +25,14 @@ public class FavoriteIOsFragment extends Fragment {
|
|||||||
*/
|
*/
|
||||||
public View onCreateView(final @NonNull LayoutInflater inflater,
|
public View onCreateView(final @NonNull LayoutInflater inflater,
|
||||||
final ViewGroup container,
|
final ViewGroup container,
|
||||||
final Bundle savedInstanceState) {
|
final Bundle savedInstanceState) {
|
||||||
this.mainActivity = (MainActivity) getActivity();
|
this.mainActivity = (MainActivity) getActivity();
|
||||||
View view = inflater.inflate(R.layout.fragment_all_ios, container,
|
View view = inflater.inflate(R.layout.fragment_all_ios, container,
|
||||||
false);
|
false);
|
||||||
ListView lv = (ListView) view.findViewById(R.id.idListView);
|
ListView lv = view.findViewById(R.id.idListView);
|
||||||
MainListViewAdapter mainListViewAdapter =
|
MainListViewAdapter mainListViewAdapter =
|
||||||
new MainListViewAdapter(mainActivity, 1);
|
new MainListViewAdapter(mainActivity, 1);
|
||||||
lv.setAdapter(mainListViewAdapter);
|
lv.setAdapter(mainListViewAdapter);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,39 +7,26 @@ import android.widget.BaseAdapter;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import com.android.volley.Response;
|
|
||||||
import com.example.aped.MainActivity;
|
import com.example.aped.MainActivity;
|
||||||
import com.example.aped.R;
|
import com.example.aped.R;
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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.*/
|
||||||
* Welche ansicht gewählt wurde 0 für all IOs, 1 für favorite IOs.
|
|
||||||
*/
|
|
||||||
private int favoriteMode;
|
private int favoriteMode;
|
||||||
/**
|
/** Name of the device for the current run.*/
|
||||||
* Name des devices für den aktuellen durchlauf.
|
|
||||||
*/
|
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
/**
|
/** Image for favorite or not.*/
|
||||||
* Bild für Favorit oder nicht.
|
|
||||||
*/
|
|
||||||
private int favoriteImage;
|
private int favoriteImage;
|
||||||
/**
|
/** List of favorites existing when opening the favorites view.*/
|
||||||
* Liste der beim öffnen der Favoritenansicht bestehenden Favoriten.
|
|
||||||
*/
|
|
||||||
private List<String> favoritenList;
|
private List<String> favoritenList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Transfer of data to MainListViewAdapter.
|
||||||
* @param pMainActivity
|
* @param pMainActivity
|
||||||
* @param pFavoriteMode
|
* @param pFavoriteMode
|
||||||
*/
|
*/
|
||||||
@ -49,24 +36,27 @@ public class MainListViewAdapter extends BaseAdapter {
|
|||||||
this.favoriteMode = pFavoriteMode;
|
this.favoriteMode = pFavoriteMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Anzahl der Anzeigen
|
* Set number of list elements.
|
||||||
|
* @return devices number
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
int devices;
|
int devices;
|
||||||
if (favoriteMode == 0) {
|
if (favoriteMode == 0) {
|
||||||
devices = mainActivity.xml.getDeviceNames().size();
|
devices = mainActivity.getXml().getDeviceNames().size();
|
||||||
} else {
|
} else {
|
||||||
devices = mainActivity.favorite.getFavorites().size();
|
devices = mainActivity.getFavorite().getFavorites().size();
|
||||||
favoritenList = new ArrayList<>(mainActivity.favorite.
|
favoritenList = new ArrayList<>(mainActivity.getFavorite()
|
||||||
getFavorites());
|
.getFavorites());
|
||||||
}
|
}
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 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
|
||||||
*/
|
*/
|
||||||
@ -77,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
|
||||||
*/
|
*/
|
||||||
@ -87,107 +79,68 @@ public class MainListViewAdapter extends BaseAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Device name display and favorite button and data sharing for state
|
||||||
|
* visitation.
|
||||||
* @param i
|
* @param i
|
||||||
* @param view
|
* @param pView
|
||||||
* @param viewGroup
|
* @param viewGroup
|
||||||
* @return view
|
* @return view
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public View getView(final int i, View view,
|
public View getView(final int i, final View pView,
|
||||||
final ViewGroup viewGroup) {
|
final ViewGroup viewGroup) {
|
||||||
view = mainActivity.getLayoutInflater().inflate(R.layout.
|
View view = mainActivity.getLayoutInflater().inflate(R.layout
|
||||||
listview_layout, null);
|
.listview_layout, null);
|
||||||
TextView textViewName = (TextView) view.findViewById(
|
TextView textViewName = view.findViewById(R.id.textName);
|
||||||
R.id.textName);
|
LinearLayout linearLayoutPin = view.findViewById(R.id
|
||||||
LinearLayout linearLayoutPin = (LinearLayout) view.findViewById(
|
.idLinearLayoutPins);
|
||||||
R.id.idLinearLayoutPins);
|
ImageView buttonViewFavoriten = view.findViewById(R.id
|
||||||
ImageView buttonViewFavoriten = (ImageView) view.findViewById(
|
.imageButtonFavoriten);
|
||||||
R.id.imageButtonFavoriten);
|
|
||||||
if (favoriteMode == 0) {
|
if (favoriteMode == 0) {
|
||||||
deviceName = mainActivity.xml.getDeviceNames().get(i);
|
deviceName = mainActivity.getXml().getDeviceNames().get(i);
|
||||||
} else {
|
} else {
|
||||||
deviceName = mainActivity.favorite.getFavorites().get(i);
|
deviceName = mainActivity.getFavorite().getFavorites().get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainActivity.favorite.getFavorites().contains(
|
if (mainActivity.getFavorite().getFavorites().contains(deviceName)) {
|
||||||
deviceName)) {
|
|
||||||
favoriteImage = android.R.drawable.btn_star_big_on;
|
favoriteImage = android.R.drawable.btn_star_big_on;
|
||||||
} else {
|
} else {
|
||||||
favoriteImage = android.R.drawable.btn_star_big_off;
|
favoriteImage = android.R.drawable.btn_star_big_off;
|
||||||
}
|
}
|
||||||
|
buttonViewFavoriten.setOnClickListener(view1 -> {
|
||||||
buttonViewFavoriten.setOnClickListener(
|
if (favoriteMode == 0) {
|
||||||
new View.OnClickListener() {
|
deviceName = mainActivity.getXml().getDeviceNames().get(i);
|
||||||
@Override
|
} else {
|
||||||
public void onClick(final View view) {
|
deviceName = favoritenList.get(i);
|
||||||
|
}
|
||||||
if (favoriteMode == 0) {
|
if (mainActivity.getFavorite().getFavorites()
|
||||||
deviceName = mainActivity.xml.getDeviceNames().
|
.contains(deviceName)) { mainActivity.getFavorite()
|
||||||
get(i);
|
.removeFavorite(deviceName);
|
||||||
} else {
|
favoriteImage = android.R.drawable.btn_star_big_off;
|
||||||
List<String> test = favoritenList;
|
buttonViewFavoriten.setImageResource(favoriteImage);
|
||||||
deviceName = favoritenList.get(i);
|
} else {
|
||||||
}
|
mainActivity.getFavorite().addFavorite(deviceName);
|
||||||
if (mainActivity.favorite.getFavorites().contains(
|
favoriteImage = android.R.drawable.btn_star_big_on;
|
||||||
deviceName)) {
|
buttonViewFavoriten.setImageResource(favoriteImage);
|
||||||
mainActivity.favorite.removeFavorite(
|
|
||||||
deviceName);
|
|
||||||
favoriteImage = android.R.drawable.btn_star_big_off;
|
|
||||||
buttonViewFavoriten.setImageResource(
|
|
||||||
favoriteImage);
|
|
||||||
} else {
|
|
||||||
mainActivity.favorite.addFavorite(
|
|
||||||
deviceName);
|
|
||||||
favoriteImage = android.R.drawable.btn_star_big_on;
|
|
||||||
buttonViewFavoriten.setImageResource(
|
|
||||||
favoriteImage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mainActivity.uebergabe.read(deviceName,
|
|
||||||
new Response.Listener<JSONObject>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(final JSONObject response) {
|
|
||||||
if (favoriteMode == 0) {
|
|
||||||
deviceName = mainActivity.xml.getDeviceNames().get(i);
|
|
||||||
} else {
|
|
||||||
deviceName = mainActivity.favorite.getFavorites().get(i);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
JSONObject state = response.getJSONObject("state");
|
|
||||||
List<String> pinValues = new ArrayList<>();
|
|
||||||
for (String pinName: ((List<String>) mainActivity.xml.
|
|
||||||
getPort(deviceName).
|
|
||||||
get("pins"))) {
|
|
||||||
pinValues.add(state.getString(pinName));
|
|
||||||
}
|
|
||||||
PinView pinView = new PinView(mainActivity, deviceName,
|
|
||||||
pinValues);
|
|
||||||
for (int j = 0; j < ((List<String>) mainActivity.xml.
|
|
||||||
getPort(deviceName).
|
|
||||||
get("pins")).size(); j++) {
|
|
||||||
linearLayoutPin.addView(pinView.getView(j));
|
|
||||||
}
|
|
||||||
} catch (JSONException e) {
|
|
||||||
// Richtigen log erstellen
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
PinView pinView = new PinView(mainActivity, deviceName);
|
||||||
|
for (int j = 0; j < ((List<String>) mainActivity.getXml()
|
||||||
|
.getPort(deviceName).get("pins")).size(); j++) {
|
||||||
|
linearLayoutPin.addView(pinView.getView(j));
|
||||||
|
}
|
||||||
String name = null;
|
String name = null;
|
||||||
switch ((mainActivity.xml.getPort(deviceName)).get("protocol").
|
switch ((mainActivity.getXml().getPort(deviceName)).get("protocol").
|
||||||
toString()) {
|
toString()) {
|
||||||
case "PWM":
|
case "PWM":
|
||||||
name = ((mainActivity.xml.getPort(deviceName)).get("protocol").
|
name = ((mainActivity.getXml().getPort(deviceName))
|
||||||
toString() + ": " + deviceName + " (" + (mainActivity.
|
.get("protocol").toString() + ": " + deviceName
|
||||||
xml.getPort(deviceName)).get("frequency").toString()
|
+ " (" + (mainActivity.getXml().getPort(deviceName))
|
||||||
+ "Hz)");
|
.get("frequency").toString() + "Hz)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
name = ((mainActivity.xml.getPort(deviceName)).get("protocol").
|
name = ((mainActivity.getXml().getPort(deviceName)).
|
||||||
toString() + ": " + deviceName);
|
get("protocol").toString() + ": " + deviceName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
textViewName.setText(name);
|
textViewName.setText(name);
|
||||||
|
@ -1,139 +1,174 @@
|
|||||||
package com.example.aped.ui.visualization;
|
package com.example.aped.ui.visualization;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.text.Html;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import com.android.volley.Response;
|
|
||||||
import com.example.aped.MainActivity;
|
import com.example.aped.MainActivity;
|
||||||
import com.example.aped.R;
|
import com.example.aped.R;
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
import com.google.android.material.slider.RangeSlider;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PinView {
|
public class PinView {
|
||||||
|
/** Include the MainActivity.*/
|
||||||
private MainActivity mainActivity;
|
private MainActivity mainActivity;
|
||||||
|
/** Image for state.*/
|
||||||
private int image;
|
private int image;
|
||||||
private List<String> pinValues;
|
/** Values of the pins.*/
|
||||||
|
private List<String> pinValues = new ArrayList<>();
|
||||||
|
/** Device name.*/
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
public PinView(MainActivity pMainActivity,String pDevice, List<String> pPinValues){
|
* Transfer of data to PinView.
|
||||||
|
* @param pMainActivity
|
||||||
|
* @param pDeviceName
|
||||||
|
*/
|
||||||
|
public PinView(final MainActivity pMainActivity, final String pDeviceName) {
|
||||||
this.mainActivity = pMainActivity;
|
this.mainActivity = pMainActivity;
|
||||||
this.deviceName = pDevice;
|
this.deviceName = pDeviceName;
|
||||||
this.pinValues = pPinValues;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processing of the data in displayed texts of the pins frequencies and
|
||||||
|
* dutycycle as well as the status lamps.
|
||||||
|
* @param i
|
||||||
|
* @return view
|
||||||
|
*/
|
||||||
public View getView(final int i) {
|
public View getView(final int i) {
|
||||||
View view = mainActivity.getLayoutInflater().inflate(R.layout.pin_listview_layout,
|
View view = mainActivity.getLayoutInflater().inflate(R.layout
|
||||||
null);
|
.pin_listview_layout, null);
|
||||||
ImageView imageView = (ImageView) view.findViewById(
|
TextView textViewPin = view.findViewById(R.id.textPin);
|
||||||
R.id.images);
|
textViewPin.setText(((List<String>) (mainActivity.getXml().
|
||||||
TextView textViewPin = (TextView) view.findViewById(
|
getPort(deviceName)).get("pins")).get(i));
|
||||||
R.id.textPin);
|
mainActivity.getDelivery().read(deviceName, response -> {
|
||||||
|
displayLamp(response, view, i);
|
||||||
|
if ((mainActivity.getXml().getPort(deviceName)).get("protocol")
|
||||||
view.setOnClickListener(new View.OnClickListener() {
|
.toString().equals("PWM")) {
|
||||||
@Override
|
textViewPin.setText(Html.fromHtml(((List<String>)
|
||||||
public void onClick(final View view) {
|
(mainActivity.getXml().getPort(deviceName)).get("pins"))
|
||||||
if((mainActivity.xml.getPort(deviceName)).get("protocol").toString().equals("DO")) {
|
.get(i) + " <b> (DC: " + pinValues.get(i) + "%) </b>"
|
||||||
try {// Werte erst aktualisieren
|
));
|
||||||
String setState = null;
|
|
||||||
if(pinValues.get(i).equals("0")) {
|
|
||||||
setState = "{\"output\": \"1\"}";
|
|
||||||
}else{
|
|
||||||
setState = "{\"output\": \"0\"}";
|
|
||||||
}
|
|
||||||
JSONObject jsonObject = new JSONObject(setState);
|
|
||||||
mainActivity.uebergabe.write(deviceName, jsonObject, new Response.Listener<JSONObject>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(JSONObject response) {
|
|
||||||
try {
|
|
||||||
if (!jsonObject.equals(response)) {
|
|
||||||
// Fehler
|
|
||||||
}
|
|
||||||
switch (response.getInt("output")){
|
|
||||||
case 1:
|
|
||||||
image = R.drawable.green_signal;
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
image = R.drawable.red_signal;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
image = R.drawable.off_signal;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
imageView.setImageResource(image);
|
|
||||||
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
Toast.makeText(mainActivity, deviceName
|
|
||||||
+ " is not an output " ,
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
mainActivity.uebergabe.read(deviceName,
|
|
||||||
new Response.Listener<JSONObject>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(final JSONObject response) {
|
|
||||||
try {
|
|
||||||
JSONObject state = response.getJSONObject("state");
|
|
||||||
//List<String> pinValues = new ArrayList<>();
|
|
||||||
pinValues.clear();
|
|
||||||
for(String pinName: ((List<String>)mainActivity.xml.
|
|
||||||
getPort(deviceName).
|
|
||||||
get("pins"))){
|
|
||||||
pinValues.add(state.getString(pinName));
|
|
||||||
}
|
|
||||||
switch (pinValues.get(i)){
|
|
||||||
case "1":
|
|
||||||
image=R.drawable.green_signal;
|
|
||||||
break;
|
|
||||||
case "0":
|
|
||||||
image=R.drawable.red_signal;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
image=R.drawable.off_signal;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
imageView.setImageResource(image);
|
|
||||||
|
|
||||||
} catch (JSONException e) {
|
|
||||||
// Richtigen log erstellen
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
switch (pinValues.get(i)){
|
view.setOnClickListener(view1 -> {
|
||||||
case "1":
|
switch ((mainActivity.getXml().getPort(deviceName)).get("protocol")
|
||||||
image=R.drawable.green_signal;
|
.toString()) {
|
||||||
break;
|
case "DO":
|
||||||
case "0":
|
try {
|
||||||
image=R.drawable.red_signal;
|
String setState;
|
||||||
break;
|
if (pinValues.get(i).equals("0")) {
|
||||||
default:
|
setState = "\"1\"";
|
||||||
image=R.drawable.off_signal;
|
} else {
|
||||||
break;
|
setState = "\"0\"";
|
||||||
}
|
}
|
||||||
imageView.setImageResource(image);
|
JSONObject jsonObject = new JSONObject(
|
||||||
|
"{\"output\":{\"" + ((List<String>) (mainActivity
|
||||||
|
.getXml().getPort(deviceName)).get("pins"))
|
||||||
|
.get(i) + "\":" + setState + "}}");
|
||||||
|
mainActivity.getDelivery().write(deviceName,
|
||||||
|
jsonObject, response -> displayLamp(response,
|
||||||
|
view1, i));
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Log.e("PinView",
|
||||||
|
"Error while generating JSON object: "
|
||||||
|
+ e.getMessage());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "PWM":
|
||||||
|
MaterialAlertDialogBuilder alert =
|
||||||
|
new MaterialAlertDialogBuilder(mainActivity);
|
||||||
|
View viewAlert = mainActivity.getLayoutInflater()
|
||||||
|
.inflate(R.layout.alert_dialog_duty, null);
|
||||||
|
RangeSlider readDuty = viewAlert.findViewById(R.id
|
||||||
|
.range_slider_duty);
|
||||||
|
readDuty.setValues(Float.valueOf(pinValues.get(i)
|
||||||
|
.equals("None") ? "0" : pinValues.get(i))
|
||||||
|
);
|
||||||
|
alert.setView(viewAlert);
|
||||||
|
alert.setPositiveButton("set", (dialog, which) -> {
|
||||||
|
int value = readDuty.getValues().get(0).intValue();
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject(
|
||||||
|
"{\"output\":{\"" + ((List<String>)
|
||||||
|
(mainActivity.getXml().getPort(deviceName))
|
||||||
|
.get("pins")).get(i) + "\":\"" + value
|
||||||
|
+ "\"}}");
|
||||||
|
mainActivity.getDelivery().write(deviceName,
|
||||||
|
jsonObject, response -> {
|
||||||
|
displayLamp(response, view1, i);
|
||||||
|
textViewPin.setText(Html.fromHtml((
|
||||||
|
(List<String>) (mainActivity.getXml()
|
||||||
|
.getPort(deviceName)).get("pins")).get(i)
|
||||||
|
+ " <b> (DC: " + pinValues.get(i)
|
||||||
|
+ "%) </b>"));
|
||||||
|
});
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Log.e("PinView",
|
||||||
|
"Error while generating JSON object: "
|
||||||
|
+ e.getMessage());
|
||||||
|
}
|
||||||
|
dialog.cancel();
|
||||||
|
});
|
||||||
|
alert.setNegativeButton("exit", (dialog,
|
||||||
|
which) -> dialog.cancel());
|
||||||
|
alert.show();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Toast.makeText(mainActivity, deviceName
|
||||||
|
+ " is not an output ", Toast.LENGTH_SHORT).
|
||||||
|
show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
textViewPin.setText(((List<String>) (mainActivity.xml.getPort(deviceName)).get("pins")).get(i));
|
});
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method for the selection of the lamps.
|
||||||
|
* @param response
|
||||||
|
* @param view
|
||||||
|
* @param i
|
||||||
|
*/
|
||||||
|
private void displayLamp(final JSONObject response, final View view,
|
||||||
|
final int i) {
|
||||||
|
ImageView imageView = view.findViewById(R.id.images);
|
||||||
|
try {
|
||||||
|
JSONObject state = response.getJSONObject("state");
|
||||||
|
if (pinValues.size() != 0) {
|
||||||
|
pinValues.clear();
|
||||||
|
}
|
||||||
|
for (String pinName: ((List<String>) mainActivity.getXml()
|
||||||
|
.getPort(deviceName).get("pins"))) {
|
||||||
|
pinValues.add(state.getString(pinName));
|
||||||
|
}
|
||||||
|
switch (pinValues.get(i)) {
|
||||||
|
case "1":
|
||||||
|
image = R.drawable.green_signal;
|
||||||
|
break;
|
||||||
|
case "0":
|
||||||
|
image = R.drawable.red_signal;
|
||||||
|
break;
|
||||||
|
case "100":
|
||||||
|
image = R.drawable.green_signal;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
image = R.drawable.off_signal;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
imageView.setImageResource(image);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Log.e("PinView", "Error while generating JSON object: "
|
||||||
|
+ e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
31
APED/app/src/main/res/layout/alert_dialog_duty.xml
Normal file
31
APED/app/src/main/res/layout/alert_dialog_duty.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/volleyToastContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
tools:ignore="MissingClass">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewSlider"
|
||||||
|
android:text="set the duty cycle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:textSize="20dp"/>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.slider.RangeSlider
|
||||||
|
android:id="@+id/range_slider_duty"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/textViewSlider"
|
||||||
|
android:valueFrom="0"
|
||||||
|
android:valueTo="100"
|
||||||
|
android:stepSize="5"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -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