alter nicht mehr benutzter Code in AllIOsFragment gelöscht
This commit is contained in:
parent
291269cc80
commit
3c33561671
@ -56,138 +56,4 @@ public class AllIOsFragment extends Fragment {
|
||||
return view;
|
||||
}
|
||||
|
||||
/** REMOVE AT LATER DATE **/
|
||||
class CustomAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
/**int count=0;
|
||||
for(int i = 0; i < mainActivity.xml.getDeviceNames().size();i++){
|
||||
count += ((List<String>)mainActivity.xml.getPort(mainActivity.xml.getDeviceNames().get(i)).get("pins")).size();
|
||||
}
|
||||
return count;*/
|
||||
return mainActivity.xml.getDeviceNames().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(final int position) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(final int position) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int i, View view,
|
||||
final ViewGroup viewGroup) {
|
||||
view = getLayoutInflater().inflate(R.layout.listview_layout,
|
||||
null);
|
||||
ImageView imageView = (ImageView) view.findViewById(
|
||||
R.id.images);
|
||||
TextView textViewName = (TextView) view.findViewById(
|
||||
R.id.textName);
|
||||
TextView textViewPin = (TextView) view.findViewById(
|
||||
R.id.textPin);
|
||||
ImageView buttonViewFavoriten = (ImageView) view.findViewById(
|
||||
R.id.imageButtonFavoriten);
|
||||
mainActivity.uebergabe.read(mainActivity.xml.getDeviceNames().
|
||||
get(i), new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(final JSONObject response) {
|
||||
try {
|
||||
String firstpinvalue = response.getJSONObject("state").getString(((List<String>) (mainActivity.xml.getPort(mainActivity.xml.getDeviceNames().get(i))).get("pins")).get(0));
|
||||
if(firstpinvalue.equals("1")) {
|
||||
image=R.drawable.green_signal;
|
||||
}else if (firstpinvalue.equals("0")) {
|
||||
image = R.drawable.red_signal;
|
||||
} else{ image = R.drawable.off_signal; }
|
||||
imageView.setImageResource(image);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
image = R.drawable.off_signal;
|
||||
imageView.setImageResource(image);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (mainActivity.favorite.getFavorites().contains(
|
||||
mainActivity.xml.getDeviceNames().get(i))) {
|
||||
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) {
|
||||
if (mainActivity.favorite.getFavorites().contains(
|
||||
mainActivity.xml.getDeviceNames().get(i))) {
|
||||
mainActivity.favorite.removeFavorite(
|
||||
mainActivity.xml.getDeviceNames().get(i));
|
||||
favoriteImage = android.R.drawable.btn_star_big_off;
|
||||
buttonViewFavoriten.setImageResource(
|
||||
favoriteImage);
|
||||
} else {
|
||||
mainActivity.favorite.addFavorite(
|
||||
mainActivity.xml.getDeviceNames().get(i));
|
||||
favoriteImage = android.R.drawable.btn_star_big_on;
|
||||
buttonViewFavoriten.setImageResource(
|
||||
favoriteImage);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Verarbeitung/ Änderung der Zustände DO
|
||||
*/
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View view) {
|
||||
Toast.makeText(getContext(), "Click auf: " + i,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
//TextView_State.setText(mainActivity.uebergabe.read(
|
||||
// mainActivity.xml.getDeviceNames().get(i)));
|
||||
/** mainActivity.uebergabe.read(mainActivity.xml.getDeviceNames().
|
||||
get(i), new Response.Listener<JSONObject>() {
|
||||
@Override
|
||||
public void onResponse(final JSONObject response) {
|
||||
try {
|
||||
JSONObject pins = response.getJSONObject("state");
|
||||
String devicename = mainActivity.xml.getDeviceNames().get(i);
|
||||
Dictionary<String,Object> portinfo = mainActivity.xml.getPort(devicename);
|
||||
List<String> pinnames = (List<String>) portinfo.get("pins");
|
||||
String firstpinname = pinnames.get(0);
|
||||
int groesse = pinnames.size();
|
||||
for(String pinname : pinnames){
|
||||
|
||||
}//anstatt for mit laufvariable
|
||||
for(int h; h < pinnames.size();h++){
|
||||
String pinname = pinnames.get(h);
|
||||
}
|
||||
String firstpinvalue = pins.getString(firstpinname);
|
||||
textViewState.setText(firstpinvalue);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
});*/
|
||||
textViewPin.setText(((List<String>) (mainActivity.xml.getPort(mainActivity.xml.getDeviceNames().get(i))).get("pins")).get(0));
|
||||
textViewName.setText(mainActivity.xml.getDeviceNames().get(i));
|
||||
buttonViewFavoriten.setImageResource(favoriteImage);
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user