2 * Copyright (C) 2012 Andrew Neal Licensed under the Apache License, Version 2.0
3 * (the "License"); you may not use this file except in compliance with the
4 * License. You may obtain a copy of the License at
5 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
6 * or agreed to in writing, software distributed under the License is
7 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 * KIND, either express or implied. See the License for the specific language
9 * governing permissions and limitations under the License.
12 package com.andrew.apollo.recycler;
14 import android.view.View;
15 import android.widget.AbsListView.RecyclerListener;
17 import com.andrew.apollo.ui.MusicHolder;
20 * A @ {@link RecyclerListener} for {@link MusicHolder}'s views.
22 * @author Andrew Neal (andrewdneal@gmail.com)
24 public class RecycleHolder implements RecyclerListener {
30 public void onMovedToScrapHeap(final View view) {
31 MusicHolder holder = (MusicHolder)view.getTag();
33 holder = new MusicHolder(view);
37 // Release mBackground's reference
38 if (holder.mBackground.get() != null) {
39 holder.mBackground.get().setImageDrawable(null);
40 holder.mBackground.get().setImageBitmap(null);
43 // Release mImage's reference
44 if (holder.mImage.get() != null) {
45 holder.mImage.get().setImageDrawable(null);
46 holder.mImage.get().setImageBitmap(null);
49 // Release mLineOne's reference
50 if (holder.mLineOne.get() != null) {
51 holder.mLineOne.get().setText(null);
54 // Release mLineTwo's reference
55 if (holder.mLineTwo.get() != null) {
56 holder.mLineTwo.get().setText(null);
59 // Release mLineThree's reference
60 if (holder.mLineThree.get() != null) {
61 holder.mLineThree.get().setText(null);