Browse Source

refactored profile manager list adapter

Alexander Brakowski 10 years ago
parent
commit
b340eb93da

+ 0 - 61
src/de/tudarmstadt/informatik/hostage/ui2/adapter/ProfileManagerListAdapter.java

@@ -33,32 +33,15 @@ public class ProfileManagerListAdapter extends ArrayAdapter<ProfileListItem> {
 		public ImageView itemIcon;
 		public ImageButton buttonEdit;
 		public ImageButton buttonDelete;
-		public ViewSwitcher switcher;
-
-		public ImageView itemIconBack;
-		public TextView labelViewBack;
 	}
 
     private final Context context;
     private final List<ProfileListItem> values;
-	private float mLastX, upX;
-	private static final int MIN_DISTANCE = 50;
-	private Animation inAnimationRL;
-	private Animation outAnimationRL;
-
-	private Animation inAnimationLR;
-	private Animation outAnimationLR;
 
     public ProfileManagerListAdapter(Context context, List<ProfileListItem> objects) {
         super(context, R.layout.profile_manager_list_item, objects);
         this.context = context;
         this.values  = objects;
-
-	    inAnimationRL = AnimationUtils.loadAnimation(getContext(), R.anim.in_right_to_left);
-	    outAnimationRL = AnimationUtils.loadAnimation(getContext(), R.anim.out_right_to_left);
-
-	    inAnimationLR = AnimationUtils.loadAnimation(getContext(), R.anim.in_left_to_right);
-	    outAnimationLR = AnimationUtils.loadAnimation(getContext(), R.anim.out_left_to_right);
     }
 
 
@@ -82,9 +65,6 @@ public class ProfileManagerListAdapter extends ArrayAdapter<ProfileListItem> {
 		    holder.itemIcon = (ImageView) rowView.findViewById(R.id.profile_manager_item_image);
 		    holder.buttonEdit = (ImageButton) rowView.findViewById(R.id.profile_manager_item_button_edit);
 		    holder.buttonDelete = (ImageButton) rowView.findViewById(R.id.profile_manager_item_button_delete);
-			//holder.switcher = (ViewSwitcher) rowView.findViewById(R.id.profile_manager_viewswitcher);
-			//holder.itemIconBack = (ImageView) rowView.findViewById(R.id.profile_manager_item_image_back);
-		    //holder.labelViewBack = (TextView) rowView.findViewById(R.id.profile_manager_item_label_back);
 
 		    rowView.setTag(holder);
 	    } else {
@@ -93,51 +73,10 @@ public class ProfileManagerListAdapter extends ArrayAdapter<ProfileListItem> {
 
 	    ((SwipeListView)parent).recycle(rowView, position);
 
-	    /*final ViewSwitcher switcher = holder.switcher;
-
-	    holder.switcher.setOnTouchListener(new OnSwipeTouchListener(){
-		    public void onSwipeRight() {
-			    //if(item.isBackVisible){
-				    switcher.setInAnimation(inAnimationLR);
-				    switcher.setOutAnimation(outAnimationLR);
-				    switcher.showPrevious();
-				    item.isBackVisible = !item.isBackVisible;
-			    //}
-		    }
-
-		    public void onSwipeLeft() {
-			    //if(!item.isBackVisible){
-				    switcher.setInAnimation(inAnimationRL);
-				    switcher.setOutAnimation(outAnimationRL);
-				    switcher.showNext();
-				    item.isBackVisible = !item.isBackVisible;
-			   // }
-		    }
-	    });
-
-	    holder.buttonEdit.setFocusable(false);
-	    holder.buttonDelete.setFocusable(false);
-	    holder.buttonEdit.setFocusableInTouchMode(false);
-	    holder.buttonDelete.setFocusableInTouchMode(false);
-*/
-
 	    holder.textView.setText(item.label);
 	    holder.labelView.setText(item.text);
-	   // holder.labelViewBack.setText(item.text);
-	   // holder.itemIconBack.setImageBitmap(item.icon);
 	    holder.itemIcon.setImageBitmap(item.icon);
 
-		/*holder.switcher.setInAnimation(null);
-	    holder.switcher.setOutAnimation(null);
-	    if(item.isBackVisible){
-		    holder.switcher.setDisplayedChild(1);
-	    } else {
-		    holder.switcher.setDisplayedChild(0);
-	    }
-
-	    holder.switcher.setInAnimation(inAnimationRL);
-		holder.switcher.setOutAnimation(outAnimationRL);*/
-
         if(!item.activated){
             RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams )holder.textView.getLayoutParams();
             lp.setMargins(0,0,0,0);