This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void displayImage(){ | |
progressDialog.setMessage("Displaying image"); | |
progressDialog.show(); | |
try { | |
StorageReference storageReference = FirebaseStorage.getInstance().getReference().child("photo_profile").child("my_photo"); | |
storageReference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() { | |
@Override | |
public void onSuccess(Uri uri) { | |
progressDialog.dismiss(); | |
Glide.with(MainActivity.this) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StorageReference ref = storageReference.child("photo_profile").child(String.valueOf(System.currentTimeMillis())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StorageReference ref = storageReference.child("photo_profile").child("my_photo"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
progressDialog.show(); | |
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { | |
CropImage.ActivityResult result = CropImage.getActivityResult(data); | |
if (resultCode == RESULT_OK) { | |
Uri resultUri = result.getUri(); | |
uploadImage(resultUri); | |
Toast.makeText(this, "URI : " + resultUri.toString(), Toast.LENGTH_SHORT).show(); | |
} else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CropImage.activity() | |
.setGuidelines(CropImageView.Guidelines.ON) | |
.setAutoZoomEnabled(true) | |
.setAspectRatio(1, 1) | |
.setCropShape(CropImageView.CropShape.OVAL) | |
.setRequestedSize(1280, 1280) | |
.start(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.putuguna.insertimagetofstorage; | |
import android.app.ProgressDialog; | |
import android.content.Intent; | |
import android.net.Uri; | |
import android.support.annotation.NonNull; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.Button; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
tools:context=".MainActivity"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 27 | |
defaultConfig { | |
applicationId "com.putuguna.insertimagetofstorage" | |
minSdkVersion 15 | |
targetSdkVersion 27 | |
versionCode 1 | |
versionName "1.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:3.1.1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.androidbie.firebasephonenumberverification; | |
import android.app.Dialog; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.support.annotation.NonNull; | |
import android.support.v4.widget.SwipeRefreshLayout; | |
import android.support.v7.app.AlertDialog; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; |