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