當前位置: 首頁>>代碼示例>>Java>>正文


Java ParseFile類代碼示例

本文整理匯總了Java中com.parse.ParseFile的典型用法代碼示例。如果您正苦於以下問題:Java ParseFile類的具體用法?Java ParseFile怎麽用?Java ParseFile使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ParseFile類屬於com.parse包,在下文中一共展示了ParseFile類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sampleFileExport

import com.parse.ParseFile; //導入依賴的package包/類
public void sampleFileExport(String fileName, String filePath) {
    String fileContent = sampleFileGetContent(filePath);
    byte[] data = fileContent.getBytes();
    ParseFile file = new ParseFile(fileName, data);

    TextView fileSize = (TextView) findViewById(R.id.sampleSize);
    fileSize.setText("" + fileContent.length());

    file.saveInBackground();
    
    ParseObject jobApplication = new ParseObject("SensoramaFile");
    jobApplication.put("fileName", fileName);
    jobApplication.put("sampleFile", file);
    jobApplication.put("devname", SRCfg.deviceName);
    jobApplication.saveInBackground();
}
 
開發者ID:wkoszek,項目名稱:sensorama,代碼行數:17,代碼來源:MainActivity.java

示例2: getContactInfos

import com.parse.ParseFile; //導入依賴的package包/類
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
	ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
	pQuery.whereContainedIn(CONFIG_USERNAME, usernames);
	pQuery.findInBackground(new FindCallback<ParseObject>() {

		@Override
		public void done(List<ParseObject> arg0, ParseException arg1) {
			if (arg0 != null) {
				List<EaseUser> mList = new ArrayList<EaseUser>();
				for (ParseObject pObject : arg0) {
				    EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME));
					ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR);
					if (parseFile != null) {
						user.setAvatar(parseFile.getUrl());
					}
					user.setNick(pObject.getString(CONFIG_NICK));
					EaseCommonUtils.setUserInitialLetter(user);
					mList.add(user);
				}
				callback.onSuccess(mList);
			} else {
				callback.onError(arg1.getCode(), arg1.getMessage());
			}
		}
	});
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:27,代碼來源:ParseManager.java

示例3: retreiveprofile

import com.parse.ParseFile; //導入依賴的package包/類
public static void retreiveprofile(String username , final Context context) {
    ParseQuery<ParseObject> query= ParseQuery.getQuery("Profile");
    query.whereEqualTo("user",username);
    query.getFirstInBackground(new GetCallback<ParseObject>() {
        @Override
        public void done(ParseObject parseObject, ParseException e) {

            if(parseObject!=null && e==null) {

                ParseFile file = (ParseFile) parseObject.get("image");
                String url = "http://wwww.webianks.com";

                if (file != null) {
                    url = file.getUrl().toString();
                }

                MainActivity.retriveProfileCallback(context, url);

            }else{
                //canntretrivee file
            }
        }
    });

}
 
開發者ID:salRoid,項目名稱:Clasick,代碼行數:26,代碼來源:DisplayImage.java

示例4: retreivetimelineprofile

import com.parse.ParseFile; //導入依賴的package包/類
public static void retreivetimelineprofile(String username , final Context context) {
    ParseQuery<ParseObject> query= ParseQuery.getQuery("Profile");
    query.whereEqualTo("user",username);
    query.getFirstInBackground(new GetCallback<ParseObject>() {
        @Override
        public void done(ParseObject parseObject, ParseException e) {

            if(parseObject!=null && e==null) {

                ParseFile file = (ParseFile) parseObject.get("image");
                String url = "http://wwww.webianks.com";
                if (file != null) {

                    url = file.getUrl().toString();
                }

                Profile.retriveTimelineProfileCallback(context, url);

            }else{
                //canntretrivee file
            }
        }
    });

}
 
開發者ID:salRoid,項目名稱:Clasick,代碼行數:26,代碼來源:DisplayImage.java

示例5: getUserDetailsFromParse

import com.parse.ParseFile; //導入依賴的package包/類
private void getUserDetailsFromParse() {
        parseUser = ParseUser.getCurrentUser();

//Fetch profile photo
        try {
            ParseFile parseFile = parseUser.getParseFile("profileThumb");
            byte[] data = parseFile.getData();
            Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
            mProfileImage.setImageBitmap(bitmap);
        } catch (Exception e) {
            e.printStackTrace();
        }

        mEmailID.setText(parseUser.getEmail());
        mUsername.setText(parseUser.getUsername());

        Toast.makeText(MainActivity.this, "Welcome back " + mUsername.getText().toString(), Toast.LENGTH_SHORT).show();

    }
 
開發者ID:Suleiman19,項目名稱:ParseApp,代碼行數:20,代碼來源:MainActivity.java

示例6: createMessage

import com.parse.ParseFile; //導入依賴的package包/類
protected ParseObject createMessage() {
	ParseObject message = new ParseObject(ParseConstants.CLASS_MESSAGES);
	message.put(ParseConstants.KEY_SENDER_ID, ParseUser.getCurrentUser().getObjectId());
	message.put(ParseConstants.KEY_SENDER_NAME, ParseUser.getCurrentUser().getUsername());
	message.put(ParseConstants.KEY_RECIPIENT_IDS, getRecipientIds());
	message.put(ParseConstants.KEY_FILE_TYPE, mFileType);
	
	byte[] fileBytes = FileHelper.getByteArrayFromFile(this, mMediaUri);
	
	if (fileBytes == null) {
		return null;
	}
	else {
		if (mFileType.equals(ParseConstants.TYPE_IMAGE)) {
			fileBytes = FileHelper.reduceImageForUpload(fileBytes);
		}
		
		String fileName = FileHelper.getFileName(this, mMediaUri, mFileType);
		ParseFile file = new ParseFile(fileName, fileBytes);
		message.put(ParseConstants.KEY_FILE, file);

		return message;
	}
}
 
開發者ID:NagabhushanS,項目名稱:AmazingFriends,代碼行數:25,代碼來源:RecipientsActivity.java

示例7: getEventFromParseObject

import com.parse.ParseFile; //導入依賴的package包/類
public static Event getEventFromParseObject(@NonNull ParseObject parseObject){
    ParseGeoPoint location = parseObject.getParseGeoPoint(Event.LOCATION);
    ParseFile parseFile = parseObject.getParseFile(Event.IMAGE);
    return new Event(parseObject.getObjectId(),
            parseObject.getString(Event.TITLE),
            parseObject.getString(Event.DESCRIPTION),
            location != null? location.getLatitude() : Event.INVALID_LOCATION,
            location != null? location.getLongitude() : Event.INVALID_LOCATION,
            parseObject.getString(Event.LOCATION_SUMMARY),
            parseObject.getString(Event.LOCATION_DESCRIPTION),
            parseFile != null? parseFile.getUrl() : null,
            parseObject.getDate(Event.INITIAL_DATE),
            // If end date is null, set it as initial date, so we can use it in our order by
            parseObject.getDate(Event.END_DATE) != null? parseObject.getDate(Event.END_DATE) : parseObject.getDate(Event.INITIAL_DATE),
            parseObject.getInt(Event.TYPE),
            parseObject.getBoolean(Event.ENABLED),
            (parseObject.getNumber(Event.GOING) != null)? parseObject.getNumber(Event.GOING).longValue() : 0,
            parseObject.getString(Event.LINK_URL),
            parseObject.getString(Event.LINK_TEXT),
            parseObject.getUpdatedAt()
    );
}
 
開發者ID:LibertACAO,項目名稱:libertacao-android,代碼行數:23,代碼來源:ParserDtoManager.java

示例8: fetchInfoFromParse

import com.parse.ParseFile; //導入依賴的package包/類
private void fetchInfoFromParse() throws Exception {
    ParseUser currentUser = ParseUser.getCurrentUser();
    if (currentUser != null) {
        if (currentUser.get(ParseTables.Users.EMAIL) != null)
            tEmail.setText(currentUser.getString(ParseTables.Users.EMAIL));

        if (currentUser.get(ParseTables.Users.INSTITUTE) != null) {
            eInstitute.setText(currentUser.getString(ParseTables.Users.INSTITUTE));
        }

        if (currentUser.get(ParseTables.Users.NAME) != null)
            tFullName.setText(currentUser.getString(ParseTables.Users.NAME));

        if (currentUser.get(ParseTables.Users.QUALIFICATIONS) != null)
            eQualificaton.setText(currentUser.getString(USER_QUALIFICATIONS));
    } else {
        //TODO: handle errors if any generated
    }

    ParseFile profileFile = null;
    if (currentUser != null) {
        profileFile = currentUser.getParseFile(ParseTables.Users.IMAGE);
    }
    imageProfile.setParseFile(profileFile);
    imageProfile.loadInBackground();
}
 
開發者ID:teamOSC,項目名稱:Studddinv2_android,代碼行數:27,代碼來源:AccountInfoFragment.java

示例9: convertFileToBitmap

import com.parse.ParseFile; //導入依賴的package包/類
public Bitmap convertFileToBitmap(ParseFile picFile){
    if(picFile == null){
        return null;
    }
    try {
        byte[] image = picFile.getData();
        if(image!=null){
            Bitmap pic = BitmapFactory.decodeByteArray(image, 0, image.length);
            return pic;
        }
    } catch (ParseException e) {
        e.printStackTrace();
        return null;
    }
    return null;
}
 
開發者ID:cfudge,項目名稱:ClassDiscuss,代碼行數:17,代碼來源:util.java

示例10: getPic

import com.parse.ParseFile; //導入依賴的package包/類
public Bitmap getPic(){
    ParseFile picFile=null;
    if(parseEntry!=null){
        if(parseEntry.getParseFile("ProfilePic")!=null){
            picFile = parseEntry.getParseFile("ProfilePic");
        };
    }

    if(picFile == null){
        return null;
    }
    try {
        byte[] image = picFile.getData();
        Bitmap pic = BitmapFactory.decodeByteArray(image, 0, image.length);
        return pic;
    } catch (ParseException e) {
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:cfudge,項目名稱:ClassDiscuss,代碼行數:21,代碼來源:Profile.java

示例11: getPic

import com.parse.ParseFile; //導入依賴的package包/類
public Bitmap getPic() {
    if(triedPostPicFetch){
        //If we've already retrieved it before(or got null)
        //return the same result
        return postPic;
    }
    triedPostPicFetch = true;
    //fetch the picfile from parse
    ParseFile picFile = getParseFile("picture");
    if (picFile == null) {
        //there is no pic for this message
        return null;
    }
    else {
        Bitmap result = ImageOperations.bitmapFromPicFile(picFile, 300, 300);
        try {
            this.pin();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        triedPostPicFetch = true;
        postPic = result;
        return result;
    }
}
 
開發者ID:cfudge,項目名稱:ClassDiscuss,代碼行數:26,代碼來源:Message.java

示例12: onResume

import com.parse.ParseFile; //導入依賴的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);
	}
}
 
開發者ID:salmank888,項目名稱:Anypic-Android,代碼行數:18,代碼來源:NewPhotoFragment.java

示例13: addSnack

import com.parse.ParseFile; //導入依賴的package包/類
/**
 * Saves a SnackEntry and its photo to Parse and adds the SnackEntry to the SnackList.
 *
 * @param entry The SnackEntry to add
 * @param photo The SnackEntry's photo
 * @param callback Optional. The callback to invoke after completion.
 */
public void addSnack(final SnackEntry entry, final ParseFile photo, @Nullable final SaveCallback callback){
    if(photo.isDirty()){
        notifyUpdateStart();
        photo.saveInBackground(new SaveCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {
                    entry.setPhoto(photo);
                    addSnack(entry, callback);
                } else if(callback != null){
                    callback.done(e);
                }
            }
        });
    } else {
        entry.setPhoto(photo);
        addSnack(entry, callback);
    }
}
 
開發者ID:SCCapstone,項目名稱:diet,代碼行數:27,代碼來源:SnackList.java

示例14: getContactInfos

import com.parse.ParseFile; //導入依賴的package包/類
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
    ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
    pQuery.whereContainedIn(CONFIG_USERNAME, usernames);
    pQuery.findInBackground(new FindCallback<ParseObject>() {

        @Override
        public void done(List<ParseObject> arg0, ParseException arg1) {
            if (arg0 != null) {
                List<EaseUser> mList = new ArrayList<EaseUser>();
                for (ParseObject pObject : arg0) {
                    EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME));
                    ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR);
                    if (parseFile != null) {
                        user.setAvatar(parseFile.getUrl());
                    }
                    user.setNick(pObject.getString(CONFIG_NICK));
                    EaseCommonUtils.setUserInitialLetter(user);
                    mList.add(user);
                }
                callback.onSuccess(mList);
            } else {
                callback.onError(arg1.getCode(), arg1.getMessage());
            }
        }
    });
}
 
開發者ID:nggirl,項目名稱:EaseChatDemo,代碼行數:27,代碼來源:ParseManager.java

示例15: doInBackground

import com.parse.ParseFile; //導入依賴的package包/類
@Override
protected Void doInBackground(Void... voids) {
    for(ParseObject o : mCatImages) {
        ParseFile file = o.getParseFile("image");
        try {
            Bitmap bmp = BitmapFactory.decodeByteArray(file.getData(), 0, file.getData().length);

            CatImage c = new CatImage();
            c.bitmap = bmp;
            c.objectId = o.getObjectId();

            mAdapter.addImage(c);
        } catch (ParseException e) {
            Log.d("CatChatTag", "Failed to decode bitmap: " + o, e);
        }
    }

    return null;
}
 
開發者ID:cat-chat,項目名稱:cat-chat-android,代碼行數:20,代碼來源:CatImagePickerActivity.java


注:本文中的com.parse.ParseFile類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。