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


Java FirebaseStorage類代碼示例

本文整理匯總了Java中com.google.firebase.storage.FirebaseStorage的典型用法代碼示例。如果您正苦於以下問題:Java FirebaseStorage類的具體用法?Java FirebaseStorage怎麽用?Java FirebaseStorage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FirebaseStorage類屬於com.google.firebase.storage包,在下文中一共展示了FirebaseStorage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import com.google.firebase.storage.FirebaseStorage; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_upload);

    mStorageRef = FirebaseStorage.getInstance().getReference();

    t1 = (EditText) findViewById(R.id.editText2);
    buttonUpload = (Button)findViewById(R.id.button3);

    if (c == 0){
        fc();
    }

    t1.setOnClickListener(this);
    buttonUpload.setOnClickListener(this);
}
 
開發者ID:nSpider,項目名稱:Paathshala,代碼行數:18,代碼來源:upload.java

示例2: onCreate

import com.google.firebase.storage.FirebaseStorage; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_new_post);

    mDatabase = FirebaseDatabase.getInstance().getReference();
    mStorage = FirebaseStorage.getInstance().getReference();

    mCriminalPicture = (ImageView)findViewById(R.id.picture_of_criminal);
    mCriminalPicture.setOnClickListener(this);
    mCriminalNameField = (EditText)findViewById(R.id.field_criminal_name);
    mBodyField = (EditText) findViewById(R.id.field_body);
    mSubmitButton = (FloatingActionButton) findViewById(R.id.fab_submit_post);
    mSpinnerType = (Spinner)findViewById(R.id.crime_type_spinner);
    ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(NewPostActivity.this,
            R.array.crimeType, android.R.layout.simple_spinner_item);
    spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mSpinnerType.setOnItemSelectedListener(NewPostActivity.this);
    mSpinnerType.setAdapter(spinnerAdapter);
    mSubmitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            submitPost();
        }
    });
}
 
開發者ID:braulio94,項目名稱:Quadro,代碼行數:27,代碼來源:NewPostActivity.java

示例3: onCreate

import com.google.firebase.storage.FirebaseStorage; //導入依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_feed);
    Log.d(TAG, "onCreate: started");
    setupBottomNavigationBar();

    mAuth = FirebaseAuth.getInstance();
    mDatabase = FirebaseDatabase.getInstance();
    mStorageRef = FirebaseStorage.getInstance().getReference();

    mFeed = findViewById(R.id.myFeed);
    Log.d(TAG, mFeed.toString());
    listAdapter = new MainFeedListAdapter(FiltersActivity.this, R.layout.layout_feed_list_item, processedImages);
    mFeed.setAdapter(listAdapter);
    downloadAsciiFeed();
}
 
開發者ID:sindhu732,項目名稱:instagram_clone,代碼行數:18,代碼來源:FiltersActivity.java

示例4: 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

示例5: uploadImageUser

import com.google.firebase.storage.FirebaseStorage; //導入依賴的package包/類
private void uploadImageUser(Uri photoUri, final Callbacks.IResultCallback<String> callback){

        //Uploading Image
        FirebaseStorage imageProfilesStorage = Library.getImageProfilesStorage();
        StorageReference imageProfilePath = imageProfilesStorage.getReference().child(photoUri.getLastPathSegment());
        imageProfilePath.putFile(photoUri)
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        // Notify error
                        callback.onDataUnavailable();
                    }
                })
                .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
                    @Override
                    public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {

                        @SuppressWarnings("VisibleForTests")
                        Uri downloadUrl = taskSnapshot.getDownloadUrl();
                        String string_dwload = downloadUrl.toString();

                        // return the photo download url
                        callback.onSuccess(string_dwload);
                    }
                });
    }
 
開發者ID:pedromassango,項目名稱:Programmers,代碼行數:27,代碼來源:UserRemoteDataSource.java

示例6: onCreate

import com.google.firebase.storage.FirebaseStorage; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_media_details);
    ButterKnife.bind(this);

    FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
    String uid = user.getUid();
    storageRef = FirebaseStorage.getInstance().getReference().child
            (uid);
    Intent incoming = getIntent();
    if (incoming.hasExtra("FIREBASE_REF")) {
        String fbUrl = incoming.getStringExtra("FIREBASE_REF");
        FirebaseDatabase db = FirebaseDatabase.getInstance();
        entriesRef = db.getReferenceFromUrl(fbUrl);
    }
    if (incoming.hasExtra("PHOTO_URI")) {
        mediaType = 2;
        try {
            dataUri = incoming.getParcelableExtra("PHOTO_URI");
            InputStream istr = getContentResolver().openInputStream
                    (dataUri);
            Bitmap bmp = BitmapFactory.decodeStream(istr);
            photoView.setImageBitmap(bmp);
            istr.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    if (incoming.hasExtra("VIDEO_URI")) {
        mediaType = 4;
        dataUri = incoming.getParcelableExtra("VIDEO_URI");
        videoView.setVideoURI(dataUri);
        MediaController mc = new MediaController(this);
        videoView.setMediaController(mc);
        photoView.setVisibility(View.INVISIBLE);
        videoView.setVisibility(View.VISIBLE);
    }
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:40,代碼來源:MediaDetailsActivity.java

示例7: 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);
        if (entry.getType() == 4) {
            initExoPlayer();
        }
    }
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:18,代碼來源:MediaViewActivity.java

示例8: 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

示例9: FindandCollectProductPdfFileLink

import com.google.firebase.storage.FirebaseStorage; //導入依賴的package包/類
public void FindandCollectProductPdfFileLink(String ProductName, String Manufacter){
     FirebaseStorage mStor = FirebaseStorage.getInstance();
     StorageReference mFindPdfStorageReference =  mStor.getReferenceFromUrl("gs://farmers-helper-44f7a.appspot.com/"+Manufacter+"/"+ProductName+"/"+ProductName+".pdf");
        mFindPdfStorageReference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
         @Override
         public void onSuccess(Uri uri) {
             mPdfUrl = String.valueOf(uri);}
     }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
                mPdfUrl="";
            }
        });





}
 
開發者ID:JamesNikolaidis,項目名稱:Thesis_Farmers_Helper,代碼行數:20,代碼來源:Database_Class_Functions.java

示例10: 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

示例11: 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

示例12: restoreValuesFromBundle

import com.google.firebase.storage.FirebaseStorage; //導入依賴的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

示例13: onCreate

import com.google.firebase.storage.FirebaseStorage; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);

    final TextView postsTextView = (TextView) findViewById(R.id.txtPosts);
    final TextView userTextView = (TextView) findViewById(R.id.txtUsers);

    authenticate();

    DatabaseReference reference = FirebaseDatabase.getInstance().getReference();

    getBlogPostsAsList(postsTextView, reference);
    getBlogPostsAsMap(postsTextView, reference);

    getUser(userTextView, reference);
    getNonExistedUser(userTextView, reference);
    getUserCustomMapper(userTextView, reference);

    StorageReference storageRef = FirebaseStorage.getInstance().getReferenceFromUrl("gs://project-1125675579821020265.appspot.com");
    downloadFile(storageRef);
    uploadFile(storageRef);

    uploadImage(storageRef);
    downloadImage(storageRef);
}
 
開發者ID:nmoskalenko,項目名稱:RxFirebase,代碼行數:27,代碼來源:SampleActivity.java

示例14: 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

示例15: continueExecution

import com.google.firebase.storage.FirebaseStorage; //導入依賴的package包/類
private void continueExecution() {
    user = auth.getCurrentUser();
    permissionStatus = "GRANTED";
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayShowTitleEnabled(false);
    }
    // Remove shared preferences from the isFirstTime value
    SharedPreferences sharedPrefs = getSharedPreferences("alertDialogPreferences",
            Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sharedPrefs.edit();
    editor.clear();
    editor.apply();
    fragmentManager = getSupportFragmentManager();
    databaseReference = FirebaseDatabase.getInstance().getReference();
    storageReference = FirebaseStorage.getInstance().getReference();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    if (user == null || user.isAnonymous()) {
        fragmentTransaction.replace(R.id.container, LoginRegisterFragment.newInstance());
    } else {
        Log.d("FIREBASE_AUTH", "USER LOGGED IN");
        ListActivity.showManageSectionFromDrawer();
        fragmentTransaction.replace(R.id.container, ReadyFragment.newInstance());
    }
    fragmentTransaction.commitAllowingStateLoss();
}
 
開發者ID:juanjecilla,項目名稱:FindMeAHome,代碼行數:26,代碼來源:AddHomeActivity.java


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