本文整理汇总了Java中com.google.firebase.storage.FirebaseStorage.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java FirebaseStorage.getInstance方法的具体用法?Java FirebaseStorage.getInstance怎么用?Java FirebaseStorage.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.firebase.storage.FirebaseStorage
的用法示例。
在下文中一共展示了FirebaseStorage.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的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;
}
}
}
示例2: onCreate
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
DaggerImageUploadComponent.builder()
.applicationComponent(((ItemReaperApplication) getApplication())
.getApplicationComponent())
.repositoryComponent(((ItemReaperApplication) getApplication())
.getRepositoryComponent())
.build()
.inject(this);
mFirebaseStorage = FirebaseStorage.getInstance();
mFirebaseUser = FirebaseAuth.getInstance().getCurrentUser();
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_grim_reaper)
.setContentTitle(getText(R.string.title_uploading_or_removing_image));
startForeground(ONGOING_NOTIFICATION_ID, mBuilder.build());
}
示例3: onCreate
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_publish);
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_grey600_24dp);
photoSize = getResources().getDimensionPixelSize(R.dimen.publish_photo_thumbnail_size);
storage = FirebaseStorage.getInstance();
storageRef = storage.getReference().child("imgaes/" + System.currentTimeMillis() + ".jpg");
if (savedInstanceState == null) {
photoUri = getIntent().getParcelableExtra(ARG_TAKEN_PHOTO_URI);
} else {
photoUri = savedInstanceState.getParcelable(ARG_TAKEN_PHOTO_URI);
}
updateStatusBarColor();
progressDialog = new ProgressDialog(this);
progressDialog.setCancelable(false);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setMessage("Wait..");
loadThumbnailPhoto();
}
示例4: includesForDeleteFiles
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
private void includesForDeleteFiles() {
FirebaseStorage storage = FirebaseStorage.getInstance();
// [START delete_file]
// Create a storage reference from our app
StorageReference storageRef = storage.getReference();
// Create a reference to the file to delete
StorageReference desertRef = storageRef.child("images/desert.jpg");
// Delete the file
desertRef.delete().addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
// File deleted successfully
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Uh-oh, an error occurred!
}
});
// [END delete_file]
}
示例5: bindToPost
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
public void bindToPost(Post post, View.OnClickListener starClickListener) {
mStorage = FirebaseStorage.getInstance();
mStorageRef = mStorage.getReferenceFromUrl("gs://project-3576505284407387518.appspot.com/");
ImageView prof_pic = (ImageView) itemView.findViewById(R.id.post_author_photo);
prof_pic.setImageResource(R.drawable.prof_pic);
loadProfPic(post.uid);
titleView.setText(post.title.substring(0,1).toUpperCase() + post.title.substring(1));
authorView.setText(post.author);
dateView.setText(post.date);
collegeView.setText(post.college);
numStarsView.setText(String.valueOf(post.starCount));
String s = post.body.substring(0, Math.min(post.body.length(), 150));
s = s.replaceAll("[\\t\\n\\r]", " ");
bodyView.setText(s + "...");
feature.setVisibility(View.GONE);
starView.setOnClickListener(starClickListener);
}
示例6: onCreateView
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_add_comic, container, false);
ButterKnife.bind(this, view);
prepareSpinner();
prepareToolbar();
storage = FirebaseStorage.getInstance();
return view ;
}
示例7: uploadFile
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
@Override
public Promise<String, BError, SaveImageProgress> uploadFile(byte[] data, String name, String mimeType) {
final Deferred<String, BError, SaveImageProgress> deferred = new DeferredObject<>();
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference storageRef = storage.getReferenceFromUrl(BDefines.FirebaseStoragePath);
StorageReference filesRef = storageRef.child("files");
final String fullName = getUUID() + "_" + name;
StorageReference fileRef = filesRef.child(fullName);
UploadTask uploadTask = fileRef.putBytes(data);
uploadTask.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
if (DEBUG) Timber.e(e.getCause(), "Firebase storage exception while saving");
deferred.reject(new BError(BError.Code.FIREBASE_STORAGE_EXCEPTION, e));
}
}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
// taskSnapshot.getMetadata() contains file metadata such as size, content-type, and download URL.
deferred.resolve(taskSnapshot.getDownloadUrl().toString());
}
});
return deferred.promise();
}
示例8: onCreate
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的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);
}
}
示例9: onCreate
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fbStorage = FirebaseStorage.getInstance();
storageRef = fbStorage.getReference();
//filePicker(); //TEST Method, proper file picker is inside maklib-ui
}
示例10: PhotoAdapter
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
public PhotoAdapter() {
super(JournalEntry.class, R.layout.photo_item,
PhotoHolder.class, photoQuery);
imgLoader = new FirebaseImageLoader();
storage = FirebaseStorage.getInstance();
selectedPosition = -1;
}
示例11: inBucket
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public StorageDistribution inBucket(String url)
{
firebaseStorage = FirebaseStorage.getInstance(url);
return this;
}
示例12: init
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
public void init() {
database = FirebaseDatabase.getInstance();
database.setPersistenceEnabled(true);
storage = FirebaseStorage.getInstance();
// Sets the maximum time to retry upload operations if a failure occurs.
storage.setMaxUploadRetryTimeMillis(Constants.Database.MAX_UPLOAD_RETRY_MILLIS);
}
示例13: onCreate
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的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);
}
}
示例14: onCreateView
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_chat_list, container, false);
mEmptyView = (TextView) view.findViewById(R.id.chat_list_empty);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.chat_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
getLoaderManager().initLoader(CURSOR_LOADER_ID, null, this);
mAdapter = new AdapterChatItem(getContext(), FirebaseStorage.getInstance(), this, null,
ContractChatList._ID);
recyclerView.setAdapter(mAdapter);
return view;
}
示例15: onCreate
import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_firstlogin);
// TODO to implement
String image = getIntent().getStringExtra(Constants.FIREBASE_USERS_IMAGE);
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
if (getSupportActionBar() != null)
getSupportActionBar().setTitle(R.string.firstlogin_title);
}
firebaseAuth = FirebaseAuth.getInstance();
firebaseUser = firebaseAuth.getCurrentUser();
firebaseStorage = FirebaseStorage.getInstance();
storageReference = firebaseStorage.getReference();
databaseReference = FirebaseDatabase.getInstance().getReference();
nameEditText = (EditText) findViewById(R.id.nameEditText);
if (firebaseUser.getDisplayName() != null && firebaseUser.getDisplayName().length() > 0)
nameEditText.setText(firebaseUser.getDisplayName());
profileImageView = (CircleImageView) findViewById(R.id.profileImageView);
profileImageView.setOnClickListener(this);
}