当前位置: 首页>>代码示例>>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;未经允许,请勿转载。