/** Use user data in GUI */ private void useUserData() { String photo = loggedUser.getPhotoLarge(); if (photo == null) { photo = loggedUser.getPhoto(); } if (photo != null) { // Set views if (loggedUser != null) { imageLoader.DisplayImage(photo, imageProfilePhoto, R.drawable.default_avatar25, 400); class LoadPhotoThread implements Runnable { public Activity activity; public RelativeLayout layout; public String url; @Override public void run() { Bitmap b = imageLoader.getBitmap(url); if (b != null) { final Bitmap background = ImageLoader.FastBlur(b, 4); b.recycle(); activity.runOnUiThread( new Runnable() { @Override public void run() { if (background != null) { layout.setBackgroundDrawable(new BitmapDrawable(background)); } } }); } } } } title.setText(getResources().getString(R.string.settings)); textNickName.setText(loggedUser.getNickName()); textEmail.setText(loggedUser.getUsername()); displayCategory(); displaySkill(); } }
@Override public void run() { Bitmap b = imageLoader.getBitmap(url); if (b != null) { final Bitmap background = ImageLoader.FastBlur(b, 4); b.recycle(); activity.runOnUiThread( new Runnable() { @Override public void run() { if (background != null) { layout.setBackgroundDrawable(new BitmapDrawable(background)); } } }); } }
/** Load profile photo */ private void loadProfilePhoto() { if (AppCAP.getLocalUserPhotoURL().length() > 5) { imageLoader.DisplayImage( AppCAP.getLocalUserPhotoLargeURL(), imageProfilePhoto, R.drawable.default_avatar25, 400); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (Constants.debugLog) Log.d( "MyUsersAdapter", "getView for " + AppCAP.cleanResponseString(mudArray.get(position).getNickName()) + ", image: " + mudArray.get(position).getFileName()); if (convertView == null) { convertView = inflater.inflate(R.layout.item_list_about_person, null); holder = new ViewHolder(convertView); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } // Display image if (AppCAP.isLoggedIn()) { holder.textNickName.setText(AppCAP.cleanResponseString(mudArray.get(position).getNickName())); imageLoader.DisplayImage( mudArray.get(position).getFileName(), holder.profileImage, R.drawable.default_avatar50, 70); } else { holder.textNickName.setText("Name Hidden"); imageLoader.DisplayImage("", holder.profileImage, R.drawable.default_avatar50_login, 70); } // Display status text if (mudArray.get(position).getStatusText() != null && mudArray.get(position).getStatusText().length() > 0) { holder.textStatus.setText( "\"" + AppCAP.cleanResponseString(mudArray.get(position).getStatusText()) + "\""); } else { holder.textStatus.setText(""); } holder.textVenueName.setText(AppCAP.cleanResponseString(mudArray.get(position).getVenueName())); // Display major job category String jobName = mudArray.get(position).getMajorJobCategory(); if (jobName != null && jobName.length() > 1) jobName = jobName.substring(0, 1).toUpperCase() + jobName.substring(1); holder.textJobName.setText(jobName); // Deafult gray line state is gone holder.textGrayLine.setVisibility(View.GONE); // Not the best check since 0, 0 is a valid lat, long, but there is no coffee or power off the // coast of Africa so we should be good if (myLat == 0 || myLng == 0) { // If we have no position fill that space with something else } else { holder.textDistance.setText( RootActivity.getDistanceBetween( myLat, myLng, mudArray.get(position).getLat(), mudArray.get(position).getLng())); } // Check if we have hereNow user if (mudArray.get(position).getCheckedIn() == 1 && mudArray.get(position).isFirstInList()) { holder.textGrayLine.setText("Checked In Now"); holder.textGrayLine.setVisibility(View.VISIBLE); } if (mudArray.get(position).getCheckedIn() == 0 && mudArray.get(position).isFirstInList()) { // it was in last seven days holder.textGrayLine.setText("Last 7 Days"); holder.textGrayLine.setVisibility(View.VISIBLE); } return convertView; }