本文整理汇总了Java中com.parse.GetDataCallback类的典型用法代码示例。如果您正苦于以下问题:Java GetDataCallback类的具体用法?Java GetDataCallback怎么用?Java GetDataCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GetDataCallback类属于com.parse包,在下文中一共展示了GetDataCallback类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResume
import com.parse.GetDataCallback; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
ParseFile photoFile = ((NewPhotoActivity) getActivity()).getImageFile();
if (photoFile != null) {
Log.i(AnypicApplication.TAG, "The photo WAS taken");
photoPreview.setParseFile(photoFile);
photoPreview.loadInBackground(new GetDataCallback() {
@Override
public void done(byte[] data, ParseException e) {
photoPreview.setVisibility(View.VISIBLE);
}
});
} else{
photoPreview.setVisibility(View.INVISIBLE);
}
}
示例2: setEvent
import com.parse.GetDataCallback; //导入依赖的package包/类
public void setEvent(Event event) {
this.event = event;
if (event.getImageFile() != null) {
if (pi != null)
pi.setProgressIndicator(-1, true);
event.getImageFile().getDataInBackground
(new GetDataCallback() {
@Override
public void done(byte[] data, ParseException e) {
Bitmap bmp = BitmapFactory.decodeByteArray
(data, 0, data.length);
ivEventImage.setImageBitmap(bmp);
if (pi != null)
pi.setProgressIndicator(-1, false);
}});
}
displayData(event);
}
示例3: getItemView
import com.parse.GetDataCallback; //导入依赖的package包/类
@Override
public View getItemView(PrsPhoto photo, View v, ViewGroup parent) {
if (v == null) {
v = View.inflate(getContext(), R.layout.photo_list_adapter, null);
}
super.getItemView(photo, v, parent);
ParseImageView photoImage = (ParseImageView) v.findViewById(R.id.icon);
ParseFile photoFile = photo.getParseFile("photo");
if (photoFile != null) {
photoImage.setParseFile(photoFile);
photoImage.loadInBackground(new GetDataCallback() {
@Override
public void done(byte[] data, ParseException e) {
// nothing to do
}
});
}
return v;
}
示例4: getItemView
import com.parse.GetDataCallback; //导入依赖的package包/类
@Override
public View getItemView(UserPicture userPicture, View v, ViewGroup parent) {
if (v == null) {
v = View.inflate(getContext(), R.layout.item_list_photos, null);
}
super.getItemView(userPicture, v, parent);
ParseImageView userImage = (ParseImageView) v.findViewById(R.id.icon);
ParseFile photoFile = userPicture.getParseFile("photo");
if (photoFile != null) {
userImage.setParseFile(photoFile);
userImage.loadInBackground(new GetDataCallback() {
@Override
public void done(byte[] arg0, ParseException arg1) {
// do nothing
Log.d(TAG, "photoFile loaded");
}
});
} else {
Log.d(TAG, "photoFile is null");
}
return v;
}
示例5: setImageViewFromKid
import com.parse.GetDataCallback; //导入依赖的package包/类
public void setImageViewFromKid(){
if (kid.getImage()!=null) {
kid.getImage().getDataInBackground(new GetDataCallback() {
@Override
public void done(@NonNull byte[] bytes, @Nullable ParseException e) {
if (e == null) {
Bitmap bitmapImage = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bitmapImage.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
kidImage.setImageBitmap(bitmapImage);
}
}
});
}
}
示例6: onBindViewHolder
import com.parse.GetDataCallback; //导入依赖的package包/类
@Override
public void onBindViewHolder(final ViewHolder viewHolder, final int i) {
viewHolder.listing_name.setText(mDataset.get(i).getString(ParseTables.Listings.LISTING_NAME));
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yy");
viewHolder.createdAt.setText(sdf.format(mDataset.get(i).getCreatedAt()));
viewHolder.listing_desc.setText(mDataset.get(i).getString(ParseTables.Listings.LISTING_DESC));
viewHolder.listing_image.setParseFile(mDataset.get(i).getParseFile(ParseTables.Listings.IMAGE));
viewHolder.listing_image.loadInBackground(new GetDataCallback() {
@Override
public void done(byte[] bytes, ParseException e) {
}
});
}
示例7: onBindViewHolder
import com.parse.GetDataCallback; //导入依赖的package包/类
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
holder.event_name.setText((String)events.get(position).get(ParseTables.Events.TITLE));
holder.event_description.setText((String)events.get(position).get(ParseTables.Events.DESCRIPTION));
holder.event_type.setText((String)events.get(position).get(ParseTables.Events.TYPE));
holder.event_date.setText(events.get(position).get(ParseTables.Events.DATE)+" "+events.get(position).get(ParseTables.Events.TIME));
holder.event_creator.setText((String)events.get(position).get(ParseTables.Events.CREATED_BY));
holder.event_location.setText((String)events.get(position).get(ParseTables.Events.LOCATION_DES));
holder.event_image.setParseFile(events.get(position).getParseFile(ParseTables.Events.IMAGE));
holder.event_image.loadInBackground(new GetDataCallback() {
@Override
public void done(byte[] bytes, ParseException e) {
Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
eventImages.add(bitmap);
}
});
holder.event_contact.setText((String)events.get(position).get(ParseTables.Events.CONTACT));
holder.event_url.setText((String)events.get(position).get(ParseTables.Events.URL));
if(check_my_events){
holder.event_creator.setVisibility(View.GONE);
holder.event_delete.setVisibility(View.VISIBLE);
}
if (position == expandedPosition) {
holder.expanded_area.setVisibility(View.VISIBLE);
} else {
holder.expanded_area.setVisibility(View.GONE);
}
}
示例8: loadParseFileImageInBackground
import com.parse.GetDataCallback; //导入依赖的package包/类
public void loadParseFileImageInBackground(ParseFile parseImageFile) {
if (parseImageFile != null) {
parseImageFile.getDataInBackground(new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
setImage(data);
} else {
Log.d("debug", "There was a problem downloading the data.");
}
}
});
} else {
Log.d("debug", "Image File is null");
}
}
示例9: getView
import com.parse.GetDataCallback; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Student student = getItem(position);
final ViewHolder viewHolder;
if (convertView != null) {
viewHolder = (ViewHolder) convertView.getTag();
} else {
viewHolder = new ViewHolder();
LayoutInflater inflater = LayoutInflater.from(getContext());
convertView = inflater.inflate(R.layout.student_list_item, parent, false);
viewHolder.rpivListStudentImage = (RoundedParseImageView) convertView.findViewById(R.id.rpivListStudentImage);
viewHolder.tvListStudentName = (TextView) convertView.findViewById(R.id.tvListStudentName);
convertView.setTag(viewHolder);
}
viewHolder.position = position;
viewHolder.tvListStudentName.setText(student.getName());
viewHolder.rpivListStudentImage.setImageResource(R.drawable.ic_placeholder);
viewHolder.rpivListStudentImage.loadParseFileImageInBackground(student.getProfileImage(), new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
if (viewHolder.position == position) {
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
viewHolder.rpivListStudentImage.setImageBitmap(bmp);
viewHolder.rpivListStudentImage.setVisibility(View.VISIBLE);
}
}
}
});
return convertView;
}
示例10: loadPhoto
import com.parse.GetDataCallback; //导入依赖的package包/类
private void loadPhoto() throws ParseException {
actionBarFont.fontChangeText(numPics, mView.getContext());
numPics.setText(picNum + " pictures to evaluate");
if (picNum > 0) {
picNum--;
mPhoto = mPhotos.get(picNum);
ParseFile pic = mPhoto.getPhoto();
ParseUser target = mPhoto.getTarget();
actionBarFont.fontChangeText(question, mView.getContext());
question.setText("Does this look like " + target.fetchIfNeeded().getString("fullName")
+ "?");
pic.getDataInBackground(new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
Bitmap bMap = BitmapFactory.decodeByteArray(data, 0, data.length);
evalPic.clearAnimation();
evalPic.setScaleType(ImageView.ScaleType.FIT_CENTER);
evalPic.setImageBitmap(bMap);
} else {
Log.e(TAG, "Parse Error: " + e.getMessage());
}
}
});
} else {
// If no more photos, return to detail fragment
Toast.makeText(getActivity().getApplicationContext(), "No Photos To Rank",
Toast.LENGTH_SHORT).show();
mActivity.getSupportFragmentManager().popBackStack();
// Fragment infoFrag = new GameInfoFragment();
// mActivity.getSupportFragmentManager().beginTransaction()
// .replace(R.id.fragment_container, infoFrag).commit();
}
}
示例11: getView
import com.parse.GetDataCallback; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final int pos = position;
if (convertView == null) {
convertView = inflat.inflate(R.layout.listview_people, null);
holder = new ViewHolder();
holder.textname = (TextView) convertView.findViewById(R.id.people_name);
holder.textinterests = (TextView) convertView.findViewById(R.id.people_interests);
holder.textinstituition = (TextView) convertView.findViewById(R.id.people_institute);
holder.textdistance = (TextView) convertView.findViewById(R.id.people_distance);
holder.textqualification = (TextView) convertView.findViewById(R.id.people_qualification);
holder.userimg = (ParseCircularImageView) convertView.findViewById(R.id.people_userimg);
convertView.setTag(holder);
}
holder = (ViewHolder) convertView.getTag();
EachRow3 row = getItem(position);
holder.textname.setText(row.cname);
holder.textinterests.setText(row.cinterests);
holder.textinstituition.setText(row.cinstituition);
holder.textdistance.setText(row.cdistance);
holder.textqualification.setText(row.cqualification);
holder.textdistance.setText(row.cdistance);
if (row.fileObject != null) {
row.fileObject
.getDataInBackground(new GetDataCallback() {
public void done(byte[] data,
ParseException e) {
if (e == null) {
if (ApplicationWrapper.LOG_DEBUG) Log.d("test",
"We've got data in data.");
holder.userimg.setImageBitmap(BitmapFactory
.decodeByteArray(
data, 0,
data.length));
} else {
if (ApplicationWrapper.LOG_DEBUG)
Log.d("test", "There was a problem downloading the data.");
}
}
});
} else {
holder.userimg.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.com_facebook_profile_picture_blank_portrait));
}
return convertView;
}
示例12: onCreateView
import com.parse.GetDataCallback; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_profile, container, false);
username = (TextView) view.findViewById(R.id.usernameTextView);
editProfile = (Button) view.findViewById(R.id.editProfileButton);
imageButton = (ImageButton) view.findViewById(R.id.profileImageButton);
postNum = (TextView) view.findViewById(R.id.postNumTextView);
followerNum = (TextView) view.findViewById(R.id.followerNumTextView);
followingNum = (TextView) view.findViewById(R.id.followingNumTextView);
getUserCountResponse();
url_array = new ArrayList<>();
image_array = new ArrayList<>();
gridView = (GridView) view.findViewById(R.id.gridView);
imgAdapter = new ImageAdapter(getActivity(),getData());
gridView.setAdapter(imgAdapter);
//set the username
currentUser = ParseUser.getCurrentUser();
username.setText(currentUser.get("FullName").toString());
//add listener to button
editProfile.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent intent = new Intent(getActivity(), EditProfileActivity.class);
startActivity(intent);
}
});
//set profile image
ParseFile imageFile = (ParseFile) currentUser.get("Image");
if (imageFile != null) {
imageFile.getDataInBackground(new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
Bitmap bitmapImage = BitmapFactory.decodeByteArray(data, 0, data.length);
imageButton.setImageBitmap(bitmapImage);
imageButton.setBackground(null);
} else {
// something went wrong
}
}
});
}else{
Drawable myDrawable = getResources().getDrawable(R.drawable.default_profile_image);
Bitmap defaultImg = ((BitmapDrawable) myDrawable).getBitmap();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
defaultImg.compress(Bitmap.CompressFormat.PNG, 0 /*ignored for PNG*/, bos);
byte[] bitmapdata = bos.toByteArray();
ParseFile image = new ParseFile("profile_pic.jpg", bitmapdata);
currentUser.put("Image", image);
currentUser.saveInBackground();
imageButton.setImageBitmap(defaultImg);
imageButton.setBackground(null);
}
registerForContextMenu(imageButton);
imageButton.setOnClickListener(new ImageButton.OnClickListener() {
@Override
public void onClick(View v) {
v.showContextMenu();
}
});
return view;
}
示例13: setImageFile
import com.parse.GetDataCallback; //导入依赖的package包/类
void setImageFile(StockImage sImage, ImageView ivImage) {
final ImageView ivImageRef = ivImage;
final StockImage sImageRef = sImage;
Log.d("DEBUG", "Fetching Data for image: " + sImageRef.getObjectId());
sImage.getImageFile().getDataInBackground
(new GetDataCallback() {
@Override
public void done(byte[] data, ParseException e) {
if (e == null) {
if (ivImageRef.getTag().equals(sImageRef.getObjectId())) {
Bitmap bmp = BitmapFactory.decodeByteArray
(data, 0, data.length);
if (bmp == null) {
Log.d("DEBUG", String.format("E: No image decoded"));
}
else if ((height == 0) || (height == bmp.getHeight())) {
Log.d("DEBUG", String.format
("Image at %dx%d fine for height=%d",
bmp.getWidth(), bmp.getHeight(), height));
ivImageRef.setImageBitmap(bmp);
}
else {
float scaleFactor = ((float)height) / bmp.getHeight();
int width = (int) Math.round
(((float)bmp.getWidth()) * scaleFactor);
Log.d("DEBUG", String.format
("Scaling %dx%d image to %dx%d",
bmp.getWidth(), bmp.getHeight(), width, height));
ivImageRef.setImageBitmap
(Bitmap.createScaledBitmap
(bmp, width, height, false));
}
}
else {
Log.d("DEBUG", "stale callback for " + sImageRef.getObjectId() + "; "
+ "Image " +ivImageRef + " is now " + ivImageRef.getTag());
}
}
else {
Log.d("ERROR", "erp! e = " + e);
}
}});
}