本文整理汇总了Java中com.avos.avoscloud.AVFile类的典型用法代码示例。如果您正苦于以下问题:Java AVFile类的具体用法?Java AVFile怎么用?Java AVFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AVFile类属于com.avos.avoscloud包,在下文中一共展示了AVFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: makeAvFileList
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
public static List<AVFile> makeAvFileList(List<String> imagesPaths){
List<AVFile> avFiles = new ArrayList<>();
if (imagesPaths != null){
for (String imagesPath : imagesPaths) {
String imageType = getImageType(imagesPath);
if (imageType != null) {
AVFile avFile = null;
try {
avFile = AVFile.withAbsoluteLocalPath(getImageName(imageType), imagesPath);
avFile.getThumbnailUrl(true,100,100);
avFiles.add(avFile);
} catch (FileNotFoundException e) {
NLog.i(TagUtil.makeTag(FileStorageHelper.class),e);
}
}
}
}
return avFiles;
}
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:20,代码来源:FileStorageHelper.java
示例2: uploadImages
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
public List<ImageInfo> uploadImages (final List<String> imagesPaths){
if (imagesPaths != null) {
List<ImageInfo> imageInfos = new ArrayList<>();
for (String imagesPath : imagesPaths) {
String imageType = getImageType(imagesPath);
if (imageType != null){
try {
AVFile avFile = AVFile.withAbsoluteLocalPath(getImageName(imageType), imagesPath);
AvObjectSaveHelper.runSaveFileSync(avFile);
ImageInfo imageInfo = new ImageInfo();
imageInfo.setThumbnailUrl(avFile.getThumbnailUrl(true,100,100));
imageInfo.setBigImageUrl(avFile.getUrl());
imageInfos.add(imageInfo);
}catch (Exception e){
NLog.e(TagUtil.makeTag(FileStorageHelper.class),e);
}
}
}
return imageInfos;
}
return null;
}
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:23,代码来源:FileStorageHelper.java
示例3: updateUserInfo
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
/**
* 上传用户信息,首先上传头像,上传成功后赶回头像地址,然后上传其他信息
*/
private void updateUserInfo(Bitmap avatar) {
//如果头像为空,也就是用户没有上传头像,则使用之前的头像地址
if (avatar == null) {
} else {
final AVFile avatarFile = new AVFile("user_avatar.jpeg", ImageUtil.bitmap2Bytes(avatar));
avatarFile.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e == null) {
Log.i("lin", "----lin----> imgUrl" + avatarFile.getUrl());
_cardView = avatarFile.getUrl();
}
}
});
}
}
开发者ID:linsir6,项目名称:TripBuyer,代码行数:26,代码来源:AuthenticationActivity.java
示例4: updateUserInfo
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
/**
* 上传用户信息,首先上传头像,上传成功后赶回头像地址,然后上传其他信息
*/
private void updateUserInfo(Bitmap avatar) {
//如果头像为空,也就是用户没有上传头像,则使用之前的头像地址
if (avatar == null) {
} else {
final AVFile avatarFile = new AVFile("user_avatar.jpeg", ImageUtil.bitmap2Bytes(avatar));
avatarFile.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e == null) {
Log.i("lin", "----lin----> imgUrl" + avatarFile.getUrl());
imageUrl = avatarFile.getUrl();
}
}
});
}
}
开发者ID:linsir6,项目名称:TripBuyer,代码行数:26,代码来源:UploadAirTicketActivity.java
示例5: setUserIconByNet
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
private void setUserIconByNet() {
Trace.d("setUserIconByNet");
ThreadPool.getInstance().execute(new Runnable() {
@Override
public void run() {
try {
final AVFile file = LoginService.getUserIcon(PreferenceUtils.getString(Config.KEY_USERICON, "", MyApplication.context));
runOnUiThread(new Runnable() {
@Override
public void run() {
Glide.with(mContext).load(file.getUrl()).into(mNavHeaderMainImg);
}
});
} catch (AVException | FileNotFoundException e) {
e.printStackTrace();
}
}
});
}
开发者ID:hkq325800,项目名称:YellowNote,代码行数:20,代码来源:MainActivity.java
示例6: onCrash
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
@Override
public void onCrash(File file) {
if (file != null && !Config.isDebugMode) {
//接下来要在此处加入将闪退日志回传到服务器的功能
try {
AVFile avFile = AVFile.withAbsoluteLocalPath(file.getName(), file.getAbsolutePath());
avFile.saveInBackground();
// AVObject crash = new AVObject("Crash");
// crash.put("user_tel", MyApplication.user);
// crash.put("crash_log", avFile);
// crash.saveInBackground();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
开发者ID:hkq325800,项目名称:YellowNote,代码行数:17,代码来源:SimpleCrashReporter.java
示例7: attachVoice
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
/**
* 上传item的音频(OOM)
* @param item item
*/
private void attachVoice(AVObject item){
int id=item.getInt("jxhid");
File file=new File("mnt/shared/jxh/voiceFile/"+id+".mp3");
if(file.exists()){
try {
AVFile avFile=AVFile.withFile("jxh_"+id+".mp3",file);//大文件会OOM
avFile.saveInBackground();
item.put("voiceFile",avFile);
item.saveInBackground();
} catch (IOException e) {
Log.e("attachVoice", e.toString());
}
}else {
Log.e("attachVoice","voice file missing"+id);
}
}
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:21,代码来源:JXH.java
示例8: uploadStoryFile
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
/**
* 为story添加file
*/
private void uploadStoryFile(){
AVQuery<AVObject> query=new AVQuery<>("story");
query.whereExists("url");
query.whereDoesNotExist("voiceFile");
query.setLimit(1000);
query.findInBackground(new FindCallback<AVObject>() {
@Override
public void done(List<AVObject> list, AVException e) {
if (e == null) {
for (AVObject item : list) {
String url = item.getString("url");
try {
AVFile avFile = AVFile.withAbsoluteLocalPath(item.getString("content") + ".mp3", "sdcard/storyFile/" + url + ".mp3");
item.put("voiceFile", avFile);
item.saveInBackground();
} catch (IOException e1) {
Log.e("upload file error", e1.toString());
}
}
}
}
});
}
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:27,代码来源:MyActivity.java
示例9: downloadVoice
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
/**
* 下载指定word的音频
* @param file 音频文件
*/
private void downloadVoice(AVFile file){
final ProgressDialog progressDialog=new ProgressDialog(this,"获取音频中");
progressDialog.show();
if(file!=null){
file.getDataInBackground(new GetDataCallback() {
@Override
public void done(byte[] bytes, AVException e) {
if(e==null){
progressDialog.dismiss();
play(bytes);
}else {
Log.e("get voice file error",e.toString());
}
}
});
}
}
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:22,代码来源:WordListActivity.java
示例10: onBindViewHolder
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
@Override
public void onBindViewHolder(final FriendListViewHolder holder, final int position)
{
AutoUtils.autoSize(holder.itemView);
User user = mDatas.get(position);
holder.mCb.setVisibility(View.GONE);
holder.mTvUsername.setText(user.getUsername());
holder.mTvSimpleDesc.setText(user.getSimpleDesc());
AVFile avatar = user.getAvatar();
if (avatar != null)
PicassoUtils.displayFitImage(mContext, Uri.parse(avatar.getThumbnailUrl(true, Constant
.AVATAR_WIDTH, Constant.AVATAR_HEIGHT)), holder.mIvAvatar, null);
else holder.mIvAvatar.setImageResource(R.mipmap.avatar);
holder.itemView.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
if (mListener != null)
mListener.onClick(holder, position);
}
});
}
开发者ID:ChenAt,项目名称:PlayTogether,代码行数:24,代码来源:FriendListAdapter.java
示例11: afterCreate
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
@Override
public void afterCreate()
{
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) actionBar.setTitle("");
User me = AVUser.getCurrentUser(User.class);
if (me == null)
{
Toast.makeText(this, "请先进行登录,", Toast.LENGTH_SHORT).show();
finish();
}
//初始化用户信息
mTvUsername.setText(me.getUsername());
AVFile avAvatar = me.getAvatar();
if (avAvatar != null)
PicassoUtils.displayFitImage(this, Uri.parse(avAvatar.getThumbnailUrl(true, Constant
.AVATAR_WIDTH, Constant.AVATAR_HEIGHT)), mIvAvatar, null);
//初始化事件
initEvent();
//初始化viewpager
initViewPagerAndTabLayout();
}
开发者ID:ChenAt,项目名称:PlayTogether,代码行数:23,代码来源:ChatHomeActivity.java
示例12: compressImageAndUpload
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
/**
* 压缩上传
*
* @return
*/
public Observable<AVFile> compressImageAndUpload(String path, int maxWidth, int maxHeight)
{
return compressImage(path, maxWidth, maxHeight)
.observeOn(Schedulers.io())
.subscribeOn(Schedulers.computation())
.flatMap(new Func1<AVFile, Observable<AVFile>>()
{
@Override
public Observable<AVFile> call(AVFile avFile)
{
return uploadFile(avFile);
}
});
}
开发者ID:ChenAt,项目名称:PlayTogether,代码行数:22,代码来源:ChatBll.java
示例13: uploadFile
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
public Observable<AVFile> uploadFile(final AVFile file)
{
return Observable.create(new Observable.OnSubscribe<AVFile>()
{
@Override
public void call(Subscriber<? super AVFile> subscriber)
{
try
{
file.save();
subscriber.onNext(file);
} catch (AVException e)
{
subscriber.onError(e);
e.printStackTrace();
}
}
});
}
开发者ID:ChenAt,项目名称:PlayTogether,代码行数:21,代码来源:ChatBll.java
示例14: compressImage
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
/**
* 压缩图片
*/
public Observable<AVIMMessage> compressImage(final AVIMImageMessage message)
{
//压缩上传的图片并重新构造 message
int maxWidth = (int) (ScreenUtils.getScreenWidth(mActivity) * ChatConstant
.MESSAGE_PIC_WIDTH_MAX_RATIO);
int maxHeight = (int) (ScreenUtils.getScreenHeight(mActivity) * ChatConstant
.MESSAGE_PIC_HEIGHT_MAX_RATIO);
return mChatBll.compressImageAndUpload(message.getLocalFilePath(), maxWidth, maxHeight)
.observeOn(AndroidSchedulers.mainThread())
.flatMap(new Func1<AVFile, Observable<AVIMMessage>>()
{
@Override
public Observable<AVIMMessage> call(AVFile file)
{
AVIMImageMessage msg = new AVIMImageMessage(file);
Map<String, Object> attrs = message.getAttrs();
msg.setAttrs(attrs);
AVIMMessage avimMessage = msg;
return Observable.just(avimMessage);
}
});
}
开发者ID:ChenAt,项目名称:PlayTogether,代码行数:26,代码来源:ChatController.java
示例15: createOrUpdateShot
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
public static void createOrUpdateShot(final String title,final String githubUrl,final String description, final String image_uri, final SaveCallback saveCallback) {
String name = System.currentTimeMillis()+"";
if (image_uri != null) {
Uri uri=Uri.parse(image_uri);
byte[] data = ImageUtils.readFile(mContext,uri);
final AVFile file = new AVFile(name, data);
file.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e != null) {
Log.d("wds",e.toString());
saveCallback.done(e);
} else {
String image_url = file.getUrl();
saveShot(title,githubUrl,description, image_url, saveCallback);
}
}
});
} else {
saveShot(title,githubUrl,description, "", saveCallback);
}
}
开发者ID:OldDriver007,项目名称:OldDriver-master,代码行数:25,代码来源:AVService.java
示例16: getItem
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
final Map<String, Object> item = new HashMap<String, Object>();
AVUser user = (AVUser) MeetList.get(position).get("user");
String name = user.getUsername();
AVFile avatar = user.getAVFile("avatar");
String avatarUrl = getAvatarUrl(user);
String times = MeetList.get(position).get("times").toString();
times = "相遇" + times + "次";
item.put("name", name);
item.put("avatar", avatarUrl);
item.put("times", times);
return item;
}
开发者ID:lanixzcj,项目名称:LoveTalkClient,代码行数:20,代码来源:MeetAdapter.java
示例17: getAvatarUrl
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
public String getAvatarUrl(AVUser avUser){
AVFile avatar = avUser.getAVFile(AVATAR);
if (avatar != null) {
return avatar.getUrl();
} else {
return null;
}
}
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:9,代码来源:UserCacheHelper.java
示例18: runSaveFileSync
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
public static void runSaveFileSync(AVFile avFile) throws InterruptedException, AVException {
final CountDownLatch lock = new CountDownLatch(1);
final AVException[] exceptions = new AVException[1];
avFile.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
exceptions[0] = e;
lock.countDown();
}
});
lock.await();
if (exceptions[0] != null){
throw exceptions[0];
}
}
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:16,代码来源:AvObjectSaveHelper.java
示例19: uploadImagesAsync
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
public void uploadImagesAsync(final List<String> imagesPaths, final DoneCallback<ImageInfo> callback){
RxjavaUtils.AsyncJob(new Runnable() {
@Override
public void run() {
if (imagesPaths != null) {
List<ImageInfo> imageInfos = new ArrayList<>();
for (String imagesPath : imagesPaths) {
String imageType = getImageType(imagesPath);
if (imageType != null){
try {
AVFile avFile = AVFile.withAbsoluteLocalPath(getImageName(imageType), imagesPath);
final String thumbNailUrl = avFile.getThumbnailUrl(true,100,100);
avFile.save();
ImageInfo imageInfo = new ImageInfo();
imageInfo.setThumbnailUrl(thumbNailUrl);
imageInfo.setBigImageUrl(avFile.getUrl());
imageInfos.add(imageInfo);
}catch (Exception e){
NLog.e(TagUtil.makeTag(FileStorageHelper.class),e);
}
}
}
callback.done(imageInfos,null);
}
}
});
}
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:29,代码来源:FileStorageHelper.java
示例20: uploadImagesTask
import com.avos.avoscloud.AVFile; //导入依赖的package包/类
public Task<List<ImageInfo>> uploadImagesTask(final List<String> imagesPaths){
return Task.forResult(imagesPaths).continueWithTask(new Continuation<List<String>, Task<List<ImageInfo>>>() {
@Override
public Task<List<ImageInfo>> then(Task<List<String>> task) throws Exception {
Exception e = task.getError();
NLog.i(TagUtil.makeTag(getClass()),"uploadImagesTask e = "+e);
if (e != null) {
return Task.forError(e);
}
List<String> ipaths = task.getResult();
List<ImageInfo> imageInfos = new ArrayList<>();
if (ipaths != null) {
for (String ipath : ipaths) {
String imageType = getImageType(ipath);
if (imageType != null){
try {
AVFile avFile = AVFile.withAbsoluteLocalPath(getImageName(imageType), ipath);
AvObjectSaveHelper.runSaveFileSync(avFile);
String thumbNailUrl = avFile.getThumbnailUrl(true,100,100);
ImageInfo imageInfo = new ImageInfo();
imageInfo.setThumbnailUrl(thumbNailUrl);
imageInfo.setBigImageUrl(avFile.getUrl());
imageInfos.add(imageInfo);
}catch (Exception exception){
return Task.forError(exception);
}
}
}
}
return Task.forResult(imageInfos);
}
},Task.BACKGROUND_EXECUTOR);
}
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:35,代码来源:FileStorageHelper.java
注:本文中的com.avos.avoscloud.AVFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论