Back to project page pinpoint-android.
The source code is released under:
MIT License
If you think the Android project pinpoint-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package co.islovely.pinpoint; /*from w ww. jav a 2 s .c o m*/ import android.content.Context; import android.graphics.BitmapFactory; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; public class HomescreenAdapter extends ArrayAdapter<Homescreen> { public HomescreenAdapter(Context context) { super(context, R.layout.item_homescreen, new ArrayList<Homescreen>()); } @Override public View getView(int position, View convertView, ViewGroup parent) { Homescreen homescreen = this.getItem(position); // check if existing view is being reused, otherwise inflate view if (convertView == null) { convertView = LayoutInflater.from(this.getContext()).inflate(R.layout.item_homescreen, parent, false); } // populate view ((TextView) convertView.findViewById(R.id.id)).setText( "" + homescreen.getId() ); for (LauncherItem launcherItem : homescreen.getLauncherItems()) { Integer imageViewId = null; if (null != launcherItem.getIcon()) { switch (launcherItem.getCellY()) { case 0: switch (launcherItem.getCellX()) { case 0: imageViewId = R.id.rowOne_columnOne; break; case 1: imageViewId = R.id.rowOne_columnTwo; break; case 2: imageViewId = R.id.rowOne_columnThree; break; case 3: imageViewId = R.id.rowOne_columnFour; break; } break; case 1: switch (launcherItem.getCellX()) { case 0: imageViewId = R.id.rowTwo_columnOne; break; case 1: imageViewId = R.id.rowTwo_columnTwo; break; case 2: imageViewId = R.id.rowTwo_columnThree; break; case 3: imageViewId = R.id.rowTwo_columnFour; break; } break; case 2: switch (launcherItem.getCellX()) { case 0: imageViewId = R.id.rowThree_columnOne; break; case 1: imageViewId = R.id.rowThree_columnTwo; break; case 2: imageViewId = R.id.rowThree_columnThree; break; case 3: imageViewId = R.id.rowThree_columnFour; break; } break; case 3: switch (launcherItem.getCellX()) { case 0: imageViewId = R.id.rowFour_columnOne; break; case 1: imageViewId = R.id.rowFour_columnTwo; break; case 2: imageViewId = R.id.rowFour_columnThree; break; case 3: imageViewId = R.id.rowFour_columnFour; break; } break; } if (null != imageViewId) { ((ImageView) convertView.findViewById(imageViewId)).setImageBitmap( BitmapFactory.decodeByteArray(launcherItem.getIcon(), 0, launcherItem.getIcon().length) ); } } } return convertView; } }