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


Java FirebaseStorage.getInstance方法代碼示例

本文整理匯總了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;
        }
    }
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:27,代碼來源:MediaViewActivity.java

示例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());
}
 
開發者ID:mvescovo,項目名稱:item-reaper,代碼行數:19,代碼來源:ImageUploadService.java

示例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();

}
 
開發者ID:NarendraSickarwar,項目名稱:FirebasePost,代碼行數:22,代碼來源:PublishActivity.java

示例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]
}
 
開發者ID:firebase,項目名稱:snippets-android,代碼行數:25,代碼來源:StorageActivity.java

示例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);
    }
 
開發者ID:imAKHILc,項目名稱:IEEE_Malabar,代碼行數:20,代碼來源:PostViewHolder.java

示例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 ;

}
 
開發者ID:jcolladosp,項目名稱:PimPam,代碼行數:15,代碼來源:AddComicFragment.java

示例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();
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:29,代碼來源:BFirebaseUploadHandler.java

示例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);
    }
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:41,代碼來源:JournalEditActivity.java

示例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
}
 
開發者ID:marckregio,項目名稱:maklib,代碼行數:11,代碼來源:FirebaseStorageActivity.java

示例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;
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:8,代碼來源:PhotoFragment.java

示例11: inBucket

import com.google.firebase.storage.FirebaseStorage; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public StorageDistribution inBucket(String url)
{
    firebaseStorage = FirebaseStorage.getInstance(url);
    return this;
}
 
開發者ID:mk-5,項目名稱:gdx-fireapp,代碼行數:10,代碼來源:Storage.java

示例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);
    }
 
開發者ID:rozdoum,項目名稱:social-app-android,代碼行數:9,代碼來源:DatabaseHelper.java

示例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);
    }
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:37,代碼來源:JournalEditActivity.java

示例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;
}
 
開發者ID:arunrajora,項目名稱:Chit-Chat,代碼行數:15,代碼來源:FragmentChatList.java

示例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);
}
 
開發者ID:marcovann,項目名稱:Firebase-Chat-Demo,代碼行數:29,代碼來源:UserFirstLoginActivity.java


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