weitere Code Conventions und auf Englisch übersetzt + Komentare
This commit is contained in:
parent
40bfeb64c0
commit
1630c2fe89
@ -2,7 +2,6 @@ package com.example.aped;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
@ -40,17 +39,17 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
/** permission code for the storage permisson.*/
|
||||
private final int STORAGE_PERMISSION_CODE = 42;
|
||||
/** was soll angezeigt werden in Navigation.*/
|
||||
private static final int STORAGE_PERMISSION_CODE = 42;
|
||||
/** What should be displayed in navigation.*/
|
||||
private AppBarConfiguration mAppBarConfiguration;
|
||||
/** zur Verwendung von xml anstatt der direkten Einbindung.*/
|
||||
public IXML xml;
|
||||
/** zur Verwendung von uebergabe anstatt der direkten Einbindung.*/
|
||||
public Communicator delivery;
|
||||
/** 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. **/
|
||||
public ConfigurationHandler configurationHandler;
|
||||
/** zur Verwendung von favorite anstatt der direkten Einbindung.*/
|
||||
public IFAVORITES favorite;
|
||||
private ConfigurationHandler configurationHandler;
|
||||
/** To use favorite instead of direct inclusion.*/
|
||||
private IFAVORITES favorite;
|
||||
/**
|
||||
* @param savedInstanceState
|
||||
*/
|
||||
@ -82,13 +81,22 @@ public class MainActivity extends AppCompatActivity {
|
||||
navController, mAppBarConfiguration);
|
||||
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
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.main, menu);
|
||||
return true;
|
||||
}
|
||||
/**Navigation einrichten.*/
|
||||
|
||||
/**
|
||||
* Set up navigation.
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean onSupportNavigateUp() {
|
||||
NavController navController = Navigation.findNavController(this,
|
||||
@ -96,32 +104,30 @@ public class MainActivity extends AppCompatActivity {
|
||||
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|
||||
|| super.onSupportNavigateUp();
|
||||
}
|
||||
/**was soll bei click auf den jeweiligen itembutton passieren.*/
|
||||
/**
|
||||
* What should happen when clicking on the respective itembutton.
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final @NonNull MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_set_IP:
|
||||
MaterialAlertDialogBuilder alert = new
|
||||
MaterialAlertDialogBuilder(MainActivity.this);
|
||||
//alert.setTitle(R.string.action_set_connection);
|
||||
View view2 = LayoutInflater.from(MainActivity.this).inflate(R.
|
||||
layout.alert_dialog_ip_pot, null);
|
||||
EditText ipAdress = (EditText) view2.findViewById(R.id.
|
||||
editTextIp);
|
||||
EditText ipAdress = view2.findViewById(R.id.editTextIp);
|
||||
ipAdress.setText(configurationHandler.getAddress());
|
||||
EditText port = (EditText) view2.findViewById(R.id.
|
||||
editTextPort);
|
||||
EditText port = view2.findViewById(R.id.editTextPort);
|
||||
port.setText(String.valueOf(configurationHandler.getPort()));
|
||||
alert.setView(view2);
|
||||
alert.setPositiveButton("set",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(final DialogInterface dialog,
|
||||
final int which) {
|
||||
// Write your code here to execute after dialog
|
||||
configurationHandler.setAddress(ipAdress.
|
||||
getText().toString());
|
||||
configurationHandler.setPort(Integer.parseInt(
|
||||
port.getText().toString()));
|
||||
(dialog, which) -> {
|
||||
configurationHandler.setAddress(ipAdress.getText()
|
||||
.toString());
|
||||
configurationHandler.setPort(Integer.parseInt(port
|
||||
.getText().toString()));
|
||||
Toast.makeText(getApplicationContext(),
|
||||
configurationHandler.getAddress()
|
||||
+ ":" + configurationHandler.
|
||||
@ -131,18 +137,13 @@ public class MainActivity extends AppCompatActivity {
|
||||
configurationHandler.getAddress(),
|
||||
configurationHandler.getPort(),
|
||||
MainActivity.this);
|
||||
}
|
||||
});
|
||||
alert.setNegativeButton("exit",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(final DialogInterface dialog,
|
||||
final int which) {
|
||||
// Write your code here to execute after dialog
|
||||
(dialog, which) -> {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
"exit clicked",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
alert.show();
|
||||
break;
|
||||
@ -316,4 +317,69 @@ public class MainActivity extends AppCompatActivity {
|
||||
+ 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;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ public class AllIOsFragment extends Fragment {
|
||||
private MainActivity mainActivity;
|
||||
|
||||
/**
|
||||
* Compiling the data and calling up the AllIOs view.
|
||||
* @param inflater
|
||||
* @param container
|
||||
* @param savedInstanceState
|
||||
@ -33,7 +34,7 @@ public class AllIOsFragment extends Fragment {
|
||||
this.mainActivity = (MainActivity) getActivity();
|
||||
View view = inflater.inflate(R.layout.fragment_all_ios, container,
|
||||
false);
|
||||
ListView lv = (ListView) view.findViewById(R.id.idListView);
|
||||
ListView lv = view.findViewById(R.id.idListView);
|
||||
MainListViewAdapter mainListViewAdapter =
|
||||
new MainListViewAdapter(mainActivity, 0);
|
||||
lv.setAdapter(mainListViewAdapter);
|
||||
|
@ -19,7 +19,7 @@ public class FavoriteIOsFragment extends Fragment {
|
||||
*/
|
||||
private MainActivity mainActivity;
|
||||
/**
|
||||
*
|
||||
*Compiling the data and calling up the FavoriteIOs view.
|
||||
* @param inflater
|
||||
* @param container
|
||||
* @param savedInstanceState
|
||||
@ -31,7 +31,7 @@ public class FavoriteIOsFragment extends Fragment {
|
||||
this.mainActivity = (MainActivity) getActivity();
|
||||
View view = inflater.inflate(R.layout.fragment_all_ios, container,
|
||||
false);
|
||||
ListView lv = (ListView) view.findViewById(R.id.idListView);
|
||||
ListView lv = view.findViewById(R.id.idListView);
|
||||
MainListViewAdapter mainListViewAdapter =
|
||||
new MainListViewAdapter(mainActivity, 1);
|
||||
lv.setAdapter(mainListViewAdapter);
|
||||
|
@ -37,6 +37,7 @@ public class MainListViewAdapter extends BaseAdapter {
|
||||
|
||||
|
||||
/**
|
||||
* Transfer of data to MainListViewAdapter.
|
||||
* @param pMainActivity
|
||||
* @param pFavoriteMode
|
||||
*/
|
||||
@ -47,17 +48,18 @@ public class MainListViewAdapter extends BaseAdapter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set number of list elements.
|
||||
* @return devices number
|
||||
*/
|
||||
@Override
|
||||
public int getCount() {
|
||||
int devices;
|
||||
if (favoriteMode == 0) {
|
||||
devices = mainActivity.xml.getDeviceNames().size();
|
||||
devices = mainActivity.getXml().getDeviceNames().size();
|
||||
} else {
|
||||
devices = mainActivity.favorite.getFavorites().size();
|
||||
favoritenList = new ArrayList<>(mainActivity.favorite.
|
||||
getFavorites());
|
||||
devices = mainActivity.getFavorite().getFavorites().size();
|
||||
favoritenList = new ArrayList<>(mainActivity.getFavorite()
|
||||
.getFavorites());
|
||||
}
|
||||
return devices;
|
||||
}
|
||||
@ -83,69 +85,68 @@ public class MainListViewAdapter extends BaseAdapter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Device name display and favorite button and data sharing for state
|
||||
* visitation.
|
||||
* @param i
|
||||
* @param view
|
||||
* @param pView
|
||||
* @param viewGroup
|
||||
* @return view
|
||||
*/
|
||||
@Override
|
||||
public View getView(final int i, View view,
|
||||
public View getView(final int i, final View pView,
|
||||
final ViewGroup viewGroup) {
|
||||
view = mainActivity.getLayoutInflater().inflate(R.layout.
|
||||
listview_layout, null);
|
||||
TextView textViewName = (TextView) view.findViewById(R.id.textName);
|
||||
LinearLayout linearLayoutPin = (LinearLayout) view.findViewById(R.id.
|
||||
idLinearLayoutPins);
|
||||
ImageView buttonViewFavoriten = (ImageView) view.findViewById(R.id.
|
||||
imageButtonFavoriten);
|
||||
View view = mainActivity.getLayoutInflater().inflate(R.layout
|
||||
.listview_layout, null);
|
||||
TextView textViewName = view.findViewById(R.id.textName);
|
||||
LinearLayout linearLayoutPin = view.findViewById(R.id
|
||||
.idLinearLayoutPins);
|
||||
ImageView buttonViewFavoriten = view.findViewById(R.id
|
||||
.imageButtonFavoriten);
|
||||
if (favoriteMode == 0) {
|
||||
deviceName = mainActivity.xml.getDeviceNames().get(i);
|
||||
deviceName = mainActivity.getXml().getDeviceNames().get(i);
|
||||
} else {
|
||||
deviceName = mainActivity.favorite.getFavorites().get(i);
|
||||
deviceName = mainActivity.getFavorite().getFavorites().get(i);
|
||||
}
|
||||
|
||||
if (mainActivity.favorite.getFavorites().contains(deviceName)) {
|
||||
if (mainActivity.getFavorite().getFavorites().contains(deviceName)) {
|
||||
favoriteImage = android.R.drawable.btn_star_big_on;
|
||||
} else {
|
||||
favoriteImage = android.R.drawable.btn_star_big_off;
|
||||
}
|
||||
buttonViewFavoriten.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
|
||||
buttonViewFavoriten.setOnClickListener(view1 -> {
|
||||
if (favoriteMode == 0) {
|
||||
deviceName = mainActivity.xml.getDeviceNames().get(i);
|
||||
deviceName = mainActivity.getXml().getDeviceNames().get(i);
|
||||
} else {
|
||||
deviceName = favoritenList.get(i);
|
||||
}
|
||||
if (mainActivity.favorite.getFavorites().contains(deviceName)) {
|
||||
mainActivity.favorite.removeFavorite(deviceName);
|
||||
if (mainActivity.getFavorite().getFavorites()
|
||||
.contains(deviceName)) { mainActivity.getFavorite()
|
||||
.removeFavorite(deviceName);
|
||||
favoriteImage = android.R.drawable.btn_star_big_off;
|
||||
buttonViewFavoriten.setImageResource(favoriteImage);
|
||||
} else {
|
||||
mainActivity.favorite.addFavorite(deviceName);
|
||||
mainActivity.getFavorite().addFavorite(deviceName);
|
||||
favoriteImage = android.R.drawable.btn_star_big_on;
|
||||
buttonViewFavoriten.setImageResource(favoriteImage);
|
||||
}
|
||||
}
|
||||
});
|
||||
PinView pinView = new PinView(mainActivity, deviceName);
|
||||
for (int j = 0; j < ((List<String>) mainActivity.xml.
|
||||
getPort(deviceName).get("pins")).size(); j++) {
|
||||
for (int j = 0; j < ((List<String>) mainActivity.getXml()
|
||||
.getPort(deviceName).get("pins")).size(); j++) {
|
||||
linearLayoutPin.addView(pinView.getView(j));
|
||||
}
|
||||
String name = null;
|
||||
switch ((mainActivity.xml.getPort(deviceName)).get("protocol").
|
||||
switch ((mainActivity.getXml().getPort(deviceName)).get("protocol").
|
||||
toString()) {
|
||||
case "PWM":
|
||||
name = ((mainActivity.xml.getPort(deviceName)).get("protocol").
|
||||
toString() + ": " + deviceName + " (" + (mainActivity.
|
||||
xml.getPort(deviceName)).get("frequency").toString()
|
||||
+ "Hz)");
|
||||
name = ((mainActivity.getXml().getPort(deviceName))
|
||||
.get("protocol").toString() + ": " + deviceName
|
||||
+ " (" + (mainActivity.getXml().getPort(deviceName))
|
||||
.get("frequency").toString() + "Hz)");
|
||||
break;
|
||||
default:
|
||||
name = ((mainActivity.xml.getPort(deviceName)).get("protocol").
|
||||
toString() + ": " + deviceName);
|
||||
name = ((mainActivity.getXml().getPort(deviceName)).
|
||||
get("protocol").toString() + ": " + deviceName);
|
||||
break;
|
||||
}
|
||||
textViewName.setText(name);
|
||||
|
@ -1,12 +1,10 @@
|
||||
package com.example.aped.ui.visualization;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.android.volley.Response;
|
||||
import com.example.aped.MainActivity;
|
||||
import com.example.aped.R;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
@ -35,6 +33,7 @@ public class PinView {
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* Transfer of data to PinView.
|
||||
* @param pMainActivity
|
||||
* @param pDeviceName
|
||||
*/
|
||||
@ -44,120 +43,85 @@ public class PinView {
|
||||
}
|
||||
|
||||
/**
|
||||
* Processing of the data in nzeigetezte of the pins frequencies and
|
||||
* dutycycle as well as the status lamps.
|
||||
* @param i
|
||||
* @return view
|
||||
*/
|
||||
public View getView(final int i) {
|
||||
View view = mainActivity.getLayoutInflater().inflate(R.layout.
|
||||
pin_listview_layout, null);
|
||||
TextView textViewPin = (TextView) view.findViewById(R.id.textPin);
|
||||
textViewPin.setText(((List<String>) (mainActivity.xml.getPort(
|
||||
deviceName)).get("pins")).get(i));
|
||||
mainActivity.delivery.read(deviceName, new Response.
|
||||
Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(final JSONObject response) {
|
||||
View view = mainActivity.getLayoutInflater().inflate(R.layout
|
||||
.pin_listview_layout, null);
|
||||
TextView textViewPin = view.findViewById(R.id.textPin);
|
||||
textViewPin.setText(((List<String>) (mainActivity.getXml().
|
||||
getPort(deviceName)).get("pins")).get(i));
|
||||
mainActivity.getDelivery().read(deviceName, response -> {
|
||||
displayLamp(response, view, i);
|
||||
if ((mainActivity.xml.getPort(deviceName)).get("protocol").
|
||||
toString().equals("PWM")) {
|
||||
if ((mainActivity.getXml().getPort(deviceName)).get("protocol")
|
||||
.toString().equals("PWM")) {
|
||||
textViewPin.setText(Html.fromHtml(((List<String>)
|
||||
(mainActivity.xml.getPort(deviceName)).get("pins")).
|
||||
get(i) + " <b> (DC: " + pinValues.get(i) + "%) </b>"
|
||||
(mainActivity.getXml().getPort(deviceName)).get("pins"))
|
||||
.get(i) + " <b> (DC: " + pinValues.get(i) + "%) </b>"
|
||||
));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
switch ((mainActivity.xml.getPort(deviceName)).get("protocol").
|
||||
toString()) {
|
||||
view.setOnClickListener(view1 -> {
|
||||
switch ((mainActivity.getXml().getPort(deviceName)).get("protocol")
|
||||
.toString()) {
|
||||
case "DO":
|
||||
try {
|
||||
String setState = null;
|
||||
String setState;
|
||||
if (pinValues.get(i).equals("0")) {
|
||||
setState = "\"1\"";
|
||||
} else {
|
||||
setState = "\"0\"";
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject(
|
||||
"{\"output\":{\"" + ((List<String>)
|
||||
(mainActivity.xml.getPort(
|
||||
deviceName)).get("pins")).
|
||||
get(i) + "\":" + setState + "}}");
|
||||
mainActivity.delivery.write(deviceName, jsonObject,
|
||||
new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(final JSONObject response
|
||||
) {
|
||||
displayLamp(response, view, i);
|
||||
}
|
||||
});
|
||||
"{\"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) {
|
||||
e.printStackTrace();
|
||||
e.printStackTrace(); // dd
|
||||
}
|
||||
break;
|
||||
case "PWM":
|
||||
MaterialAlertDialogBuilder alert =
|
||||
new MaterialAlertDialogBuilder(mainActivity);
|
||||
View viewAlert = mainActivity.getLayoutInflater().
|
||||
inflate(R.layout.alert_dialog_duty, null);
|
||||
RangeSlider readDuty = (RangeSlider) viewAlert.
|
||||
findViewById(R.id.range_slider_duty);
|
||||
readDuty.setValues((float) Float.valueOf(pinValues.
|
||||
get(i).equals("None") ? "0" : pinValues.get(i))
|
||||
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",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(
|
||||
final DialogInterface dialog,
|
||||
final int which) {
|
||||
int value = readDuty.getValues().get(0).
|
||||
intValue();
|
||||
alert.setPositiveButton("set", (dialog, which) -> {
|
||||
int value = readDuty.getValues().get(0).intValue();
|
||||
try {
|
||||
JSONObject jsonObject =
|
||||
new JSONObject("{\"output\":{\""
|
||||
+ ((List<String>) (
|
||||
mainActivity.xml.getPort(
|
||||
deviceName)).get("pins")
|
||||
).get(i) + "\":\""
|
||||
+ value + "\"}}");
|
||||
mainActivity.delivery.write(
|
||||
deviceName, jsonObject,
|
||||
new Response.
|
||||
Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(
|
||||
final JSONObject response) {
|
||||
displayLamp(response, view,
|
||||
i);
|
||||
textViewPin.setText(Html.
|
||||
fromHtml((
|
||||
(List<String>) (
|
||||
mainActivity.xml.
|
||||
getPort(deviceName)).
|
||||
get("pins")).get(i)
|
||||
+ " <b> (DC: "
|
||||
+ pinValues.get(i)
|
||||
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) {
|
||||
e.printStackTrace(); // aaaaa
|
||||
}
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
alert.setNegativeButton("exit",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(
|
||||
final DialogInterface dialog,
|
||||
final int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
alert.setNegativeButton("exit", (dialog,
|
||||
which) -> dialog.cancel());
|
||||
alert.show();
|
||||
break;
|
||||
default:
|
||||
@ -168,21 +132,26 @@ public class PinView {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
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 = (ImageView) view.findViewById(R.id.images);
|
||||
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.xml.
|
||||
getPort(deviceName).get("pins"))) {
|
||||
for (String pinName: ((List<String>) mainActivity.getXml()
|
||||
.getPort(deviceName).get("pins"))) {
|
||||
pinValues.add(state.getString(pinName));
|
||||
}
|
||||
switch (pinValues.get(i)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user