• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FirebaseImageLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.firebase.ui.storage.images.FirebaseImageLoader的典型用法代码示例。如果您正苦于以下问题:Java FirebaseImageLoader类的具体用法?Java FirebaseImageLoader怎么用?Java FirebaseImageLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FirebaseImageLoader类属于com.firebase.ui.storage.images包,在下文中一共展示了FirebaseImageLoader类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_media_view);
    ButterKnife.bind(this);

    imgLoader = new FirebaseImageLoader();
    storage = FirebaseStorage.getInstance();
    Intent incoming = getIntent();
    if (incoming.hasExtra("JRNL_ENTRY")) {
        Parcelable parcel = incoming.getParcelableExtra("JRNL_ENTRY");
        entry = Parcels.unwrap(parcel);
        if (entry.getType() == 4) {
            initExoPlayer();
        }
    }
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:18,代码来源:MediaViewActivity.java


示例2: onCreate

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_media_view);
    ButterKnife.bind(this);

    imgLoader = new FirebaseImageLoader();
    storage = FirebaseStorage.getInstance();
    Intent incoming = getIntent();
    if (incoming.hasExtra("JRNL_ENTRY")) {
        Parcelable parcel = incoming.getParcelableExtra("JRNL_ENTRY");
        entry = Parcels.unwrap(parcel);
        switch (entry.getType()) {
            case 1:
                break;
            case 2:
                videoView.setVisibility(View.GONE);
                break;
            case 3:
            case 4:
                photoView.setVisibility(View.GONE);
                initExoPlayer();
                break;
        }
    }
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:27,代码来源:MediaViewActivity.java


示例3: restoreValuesFromBundle

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
private void restoreValuesFromBundle(Bundle bundle) {

		if (bundle.getString("type").equals("bot_data_model")) {
			botData = bundle.getParcelable("data");
			chat_name_textview.setText(botData.getName());
			contactData = new ContactItemDataModel(botData.getGid(), true);
			if (botData.getImage_url() != null) {
				Glide.with(this)
						.using(new FirebaseImageLoader())
						.load(FirebaseStorage.getInstance().getReference(botData.getImage_url()))
						.into(chat_image_imageview);
				chat_name_textview.setContentDescription(String.format(getString(R.string.chatbot_cd), botData.getName()));
				chat_image_imageview.setContentDescription(String.format(getString(R.string.pp_chat_bot_cd), botData.getName()));
			}
		} else {
			contactData = bundle.getParcelable("data");
			getSupportLoaderManager().initLoader(CURSOR_CONTACT_ITEM_LOADER_ID, null, this);
		}
		if (bundle.containsKey("openindex")) {
			mOpenIndexSet = (HashSet<Integer>) bundle.getSerializable("openindex");
		}

	}
 
开发者ID:arunrajora,项目名称:Chit-Chat,代码行数:24,代码来源:ChatActivity.java


示例4: loadProfilePhoto

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
/**
 * Load profile photo of the plant
 */
private void loadProfilePhoto() {
    if (mPlantReference != null) {
        final DatabaseReference photoFileNameReference = mPlantReference.child("profilePhoto");
        photoFileNameReference.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(@NotNull DataSnapshot dataSnapshot) {
                if (dataSnapshot.exists()) {
                    String fileName = dataSnapshot.getValue(String.class);
                    ImageView profilePictureView = getActivity().findViewById(R.id.plant_picture);
                    int placeHolderResId = R.drawable.flowey;
                    if (fileName != null && !fileName.equals("default")) {
                        StorageReference photoFileReference = mUserStorage.child(fileName);
                        Glide.with(getActivity()).using(new FirebaseImageLoader()).
                                load(photoFileReference).dontAnimate().placeholder(placeHolderResId).into(profilePictureView);
                    } else {
                        Glide.with(getActivity()).load(placeHolderResId).dontAnimate().placeholder(placeHolderResId).into(profilePictureView);
                    }
                }
            }

            @Override
            public void onCancelled(@NotNull DatabaseError databaseError) {

            }
        });
    }
}
 
开发者ID:iskandergaba,项目名称:Botanist,代码行数:31,代码来源:PlantController.java


示例5: onCreate

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_journal_edit);
    ButterKnife.bind(this);
    Intent incoming = getIntent();
    imgLoader = new FirebaseImageLoader();
    FirebaseStorage storage = FirebaseStorage.getInstance();
    if (incoming.hasExtra("JRNL_ENTRY")) {
        Parcelable parcel = incoming.getParcelableExtra("JRNL_ENTRY");
        entry = Parcels.unwrap(parcel);
        String url = null;
        if (entry.getType() == 2) {
            url = entry.getUrl();
            fabCover.setVisibility(View.VISIBLE);
        }
        else if (entry.getType() == 4) {
            url = entry.getThumbnailUrl();
            fabCover.setVisibility(View.GONE);
        }
        if (url != null) {
            Glide.with(this)
                    .using(imgLoader)
                    .load(storage.getReferenceFromUrl(url))
                    .into(this.imageView);
        }
        caption.setText(entry.getCaption());
        dateTime.setText(entry.getDate());
    }
    if (incoming.hasExtra("DB_REF")) {
        String ref = incoming.getStringExtra("DB_REF");
        parentRef = FirebaseDatabase.getInstance().getReferenceFromUrl(ref);
        String entryKey = incoming.getStringExtra("JRNL_KEY");
        myRef = parentRef.child("entries").child(entryKey);
    }
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:37,代码来源:JournalEditActivity.java


示例6: onCreate

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_journal_edit);
    ButterKnife.bind(this);
    Intent incoming = getIntent();
    imgLoader = new FirebaseImageLoader();
    FirebaseStorage storage = FirebaseStorage.getInstance();
    if (incoming.hasExtra("JRNL_ENTRY")) {
        Parcelable parcel = incoming.getParcelableExtra("JRNL_ENTRY");
        entry = Parcels.unwrap(parcel);
        String url = null;
        if (entry.getType() == 2) {
            url = entry.getUrl();
            fabCover.setVisibility(View.VISIBLE);
        }
        else if (entry.getType() == 3) {
            fabCover.setVisibility(View.GONE);
            imageView.setImageResource(R.drawable.transparent_box);
        }
        else if (entry.getType() == 4) {
            url = entry.getThumbnailUrl();
            fabCover.setVisibility(View.GONE);
        }
        if (url != null) {
            Glide.with(this)
                    .using(imgLoader)
                    .load(storage.getReferenceFromUrl(url))
                    .into(this.imageView);
        }
        caption.setText(entry.getCaption());
        dateTime.setText(entry.getDate());
    }
    if (incoming.hasExtra("DB_REF")) {
        String ref = incoming.getStringExtra("DB_REF");
        parentRef = FirebaseDatabase.getInstance().getReferenceFromUrl(ref);
        String entryKey = incoming.getStringExtra("JRNL_KEY");
        myRef = parentRef.child("entries").child(entryKey);
    }
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:41,代码来源:JournalEditActivity.java


示例7: PhotoAdapter

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
public PhotoAdapter() {
    super(JournalEntry.class, R.layout.photo_item,
            PhotoHolder.class, photoQuery);
    imgLoader = new FirebaseImageLoader();
    storage = FirebaseStorage.getInstance();
    selectedPosition = -1;
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:8,代码来源:PhotoFragment.java


示例8: displayPotentMatchProfilePic

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
private void displayPotentMatchProfilePic( String matchUserID ) {
    // Try to fetch profile pic from Firebase and update ImageView
    // If profile pic is null, display default profile pic instead
    dbHelper.getDb().getReference(dbHelper.getUserPath()).child( matchUserID ).child("profile_pic").addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            String url = "";

            if (dataSnapshot != null && dataSnapshot.getValue() != null) {
                url = (String) dataSnapshot.getValue();
                if (imgView != null) {
                    StorageReference uriRef = dbHelper.getStorage().getReferenceFromUrl(url);

                    // Set ImageView to contain photo
                    Glide.with(getApplicationContext())
                            .using(new FirebaseImageLoader())
                            .load(uriRef)
                            .into(imgView);
                }
            } else {
                // Default Profile Pic
                resetImageView();
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
        }
    });
}
 
开发者ID:chrisqz95,项目名称:couch-potatoes,代码行数:31,代码来源:MatchingActivity.java


示例9: displayProfilePic

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
private void displayProfilePic() {
    dbHelper.getDb().getReference(dbHelper.getUserPath()).child( currUserID ).child("profile_pic").addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            String url = "";

            if (dataSnapshot != null && dataSnapshot.getValue() != null) {
                url = (String) dataSnapshot.getValue();
                if (imgView != null) {
                    StorageReference uriRef = dbHelper.getStorage().getReferenceFromUrl(url);

                    // Set ImageView to contain photo
                    Glide.with(getApplicationContext())
                            .using(new FirebaseImageLoader())
                            .load(uriRef)
                            .into(imgView);
                }
            } else {
                // Default Profile Pic
                //url = "gs://couch-potatoes-47758.appspot.com/Default/ProfilePic/potato_1_profile_pic.png";
                String uri = "@drawable/profile";

                int imageResource = getResources().getIdentifier(uri, null, getPackageName());
                Drawable res = getResources().getDrawable(imageResource);
                imgView.setImageDrawable(res);
            }
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {}
    });
}
 
开发者ID:chrisqz95,项目名称:couch-potatoes,代码行数:33,代码来源:ProfileActivity.java


示例10: loadBitmapFromFirebase

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
public static void loadBitmapFromFirebase(Context context, String url, int placeholderId, ImageView target) {
	Glide.with(context)
			.using(new FirebaseImageLoader())
			.load(FirebaseStorage.getInstance().getReference(url))
			.diskCacheStrategy(DiskCacheStrategy.RESULT)
			.centerCrop()
			.placeholder(placeholderId)
			.error(placeholderId)
			.crossFade()
			.into(target);
}
 
开发者ID:arunrajora,项目名称:Chit-Chat,代码行数:12,代码来源:ImageUtils.java


示例11: onBindViewHolder

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    // - get element from your dataset at this position
    // - replace the contents of the view with that element
    final Photo photo = mDataset.get(position);
    final String photoKey = mKeyList.get(position);

    // Create a reference with an initial file path and name
    StorageReference pathReference = storageRef.child(photo.getPhotoRef());

    Glide.with(holder.mImageView.getContext())
            .using(new FirebaseImageLoader())
            .load(pathReference)
            .placeholder(R.color.placeholder)
            .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .into(holder.mImageView);
    String titleAuthorString = String.format("By %1$s", photo.getAuthorName());
    holder.mTextView.setText(titleAuthorString);

    holder.mImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(mContext, DetailActivity.class);
            ActivityOptionsCompat options = ActivityOptionsCompat.
                    makeSceneTransitionAnimation(mActivity, holder.mImageView, mContext.getString(R.string.transition_photo));
            i.putExtra("photo", photo);
            i.putExtra("key", photoKey);
            mContext.startActivity(i, options.toBundle());
        }
    });
}
 
开发者ID:robertmathew,项目名称:KeralaAttractions,代码行数:32,代码来源:PhotoAdapter.java


示例12: onCreate

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_journal_view);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    entries.setLayoutManager(new LinearLayoutManager(this));
    FirebaseImageLoader imgLoader = new FirebaseImageLoader();
    Intent incoming = getIntent();
    if (incoming.hasExtra("TRIP")) {
        Parcelable par = incoming.getParcelableExtra("TRIP");
        Trip t = Parcels.unwrap(par);
        tripKey = t.getKey();
        title.setText(t.getName());
        FirebaseDatabase dbRef = FirebaseDatabase.getInstance();
        FirebaseAuth auth = FirebaseAuth.getInstance();
        FirebaseUser user = auth.getCurrentUser();
        entriesRef = dbRef.getReference(user.getUid())
                .child(tripKey + "/entries");
        storage = FirebaseStorage.getInstance();
        adapter = new FirebaseRecyclerAdapter<JournalEntry, EntryHolder>
                (JournalEntry.class, R.layout.journal_entry_item,
                        EntryHolder.class, entriesRef) {

            @Override
            protected void populateViewHolder(EntryHolder viewHolder, JournalEntry model, int position) {
                viewHolder.setCaption(model.getCaption());
                viewHolder.setDate(model.getDate());

                switch (model.getType()) {
                    case 2: // photo
                        viewHolder.topImage.setVisibility(View.VISIBLE);
                        viewHolder.playIcon.setVisibility(View.GONE);
                        Glide.with(viewHolder.topImage.getContext())
                                .using(imgLoader)
                                .load(storage.getReferenceFromUrl(model.getUrl()))
                                .into(viewHolder.topImage);
                        break;
                    case 4: // video
                        viewHolder.topImage.setVisibility(View.VISIBLE);
                        viewHolder.playIcon.setVisibility(View.VISIBLE);
                        Glide.with(viewHolder.topImage.getContext())
                                .using(imgLoader)
                                .load(storage.getReferenceFromUrl
                                        (model.getThumbnailUrl()))
                                .into(viewHolder.topImage);
                        break;
                    default:
                        viewHolder.topImage.setVisibility(View.GONE);
                        break;
                }
                viewHolder.editBtn.setOnClickListener( view -> {
                    String key = getRef(position).getKey();
                    toMediaEdit(model, key);
                });
                viewHolder.topImage.setOnClickListener( view -> {
                    toMediaView(model);
                });
            }

        };
        entries.setAdapter(adapter);
    }
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:65,代码来源:JournalViewActivity.java


示例13: onCreate

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_journal_view);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    entries.setLayoutManager(new LinearLayoutManager(this));
    FirebaseImageLoader imgLoader = new FirebaseImageLoader();
    Intent incoming = getIntent();
    if (incoming.hasExtra("TRIP")) {
        Parcelable par = incoming.getParcelableExtra("TRIP");
        Trip t = Parcels.unwrap(par);
        tripKey = t.getKey();
        title.setText(t.getName());
        FirebaseDatabase dbRef = FirebaseDatabase.getInstance();
        FirebaseAuth auth = FirebaseAuth.getInstance();
        FirebaseUser user = auth.getCurrentUser();
        entriesRef = dbRef.getReference(user.getUid())
                .child(tripKey + "/entries");
        storage = FirebaseStorage.getInstance();
        adapter = new FirebaseRecyclerAdapter<JournalEntry, EntryHolder>
                (JournalEntry.class, R.layout.journal_entry_item,
                        EntryHolder.class, entriesRef) {

            @Override
            protected void populateViewHolder(EntryHolder viewHolder, JournalEntry model, int position) {
                viewHolder.setCaption(model.getCaption());
                viewHolder.setDate(model.getDate());

                switch (model.getType()) {
                    case 1:
                        viewHolder.mediaContainer.setVisibility(View
                                .GONE);
                        break;
                    case 2: // photo
                        viewHolder.topImage.setVisibility(View.VISIBLE);
                        viewHolder.playIcon.setVisibility(View.GONE);
                        Glide.with(viewHolder.topImage.getContext())
                                .using(imgLoader)
                                .load(storage.getReferenceFromUrl(model.getUrl()))
                                .into(viewHolder.topImage);
                        break;
                    case 3: // audio
                        viewHolder.topImage.setVisibility(View.VISIBLE);
                        viewHolder.playIcon.setVisibility(View.VISIBLE);
                        break;
                    case 4: // video
                        viewHolder.topImage.setVisibility(View.VISIBLE);
                        viewHolder.playIcon.setVisibility(View.VISIBLE);
                        Glide.with(viewHolder.topImage.getContext())
                                .using(imgLoader)
                                .load(storage.getReferenceFromUrl
                                        (model.getThumbnailUrl()))
                                .into(viewHolder.topImage);
                        break;
                    default:
                        viewHolder.topImage.setVisibility(View.GONE);
                        break;
                }
                viewHolder.editBtn.setOnClickListener( view -> {
                    String key = getRef(position).getKey();
                    toMediaEdit(model, key);
                });
                viewHolder.topImage.setOnClickListener( view -> {
                    toMediaView(model);
                });
                viewHolder.playIcon.setOnClickListener( view -> {
                    toMediaView(model);
                });
            }

        };
        entries.setAdapter(adapter);
        entries.addItemDecoration(verticalGap);
    }
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:77,代码来源:JournalViewActivity.java


示例14: registerComponents

import com.firebase.ui.storage.images.FirebaseImageLoader; //导入依赖的package包/类
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
    // Register FirebaseImageLoader to handle StorageReference
    registry.append(StorageReference.class, InputStream.class,
            new FirebaseImageLoader.Factory());
}
 
开发者ID:firebase,项目名称:FirebaseUI-Android,代码行数:7,代码来源:MyAppGlideModule.java



注:本文中的com.firebase.ui.storage.images.FirebaseImageLoader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StaticNativeAd类代码示例发布时间:2022-05-23
下一篇:
Java DoubleConverter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap