diff --git a/app/MyHyvesBookPlusStagram/app/build.gradle b/app/MyHyvesBookPlusStagram/app/build.gradle index dadf17f..907707c 100644 --- a/app/MyHyvesBookPlusStagram/app/build.gradle +++ b/app/MyHyvesBookPlusStagram/app/build.gradle @@ -26,11 +26,14 @@ dependencies { }) compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:design:25.3.1' - compile 'com.google.firebase:firebase-database:10.0.1' - compile 'com.google.firebase:firebase-auth:10.0.1' + compile 'com.google.firebase:firebase-database:11.0.1' + compile 'com.google.firebase:firebase-auth:11.0.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support:support-v4:25.3.1' - compile 'com.google.firebase:firebase-storage:10.0.1' + compile 'com.google.firebase:firebase-storage:11.0.1' + + // FirebaseUI Storage only + compile 'com.firebaseui:firebase-ui-storage:2.0.1' testCompile 'junit:junit:4.12' } diff --git a/app/MyHyvesBookPlusStagram/app/src/main/java/nl/myhyvesbookplus/tagram/ProfileFragment.java b/app/MyHyvesBookPlusStagram/app/src/main/java/nl/myhyvesbookplus/tagram/ProfileFragment.java index 0534297..37ca392 100644 --- a/app/MyHyvesBookPlusStagram/app/src/main/java/nl/myhyvesbookplus/tagram/ProfileFragment.java +++ b/app/MyHyvesBookPlusStagram/app/src/main/java/nl/myhyvesbookplus/tagram/ProfileFragment.java @@ -11,8 +11,16 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; +import android.widget.ImageView; +import com.bumptech.glide.Glide; +import com.firebase.ui.storage.images.FirebaseImageLoader; import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.auth.FirebaseUser; +import com.google.firebase.storage.FirebaseStorage; +import com.google.firebase.storage.StorageReference; +import com.google.firebase.auth.FirebaseAuth; + /** @@ -41,6 +49,9 @@ public class ProfileFragment extends Fragment implements View.OnClickListener{ // Required empty public constructor } + protected StorageReference httpsReference; + protected ImageView profilePicture; + /** * Use this factory method to create a new instance of * this fragment using the provided parameters. @@ -66,6 +77,11 @@ public class ProfileFragment extends Fragment implements View.OnClickListener{ mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } + + FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); + if (user != null) { + httpsReference = FirebaseStorage.getInstance().getReferenceFromUrl(user.getPhotoUrl().toString()); + } } /** @@ -73,6 +89,7 @@ public class ProfileFragment extends Fragment implements View.OnClickListener{ */ protected void findViews(View view) { profilePicButton = (Button) view.findViewById(R.id.profile_pic_button); + profilePicture = (ImageView) view.findViewById(R.id.imageView_profile_picture); bindOnClick(); } @@ -86,6 +103,7 @@ public class ProfileFragment extends Fragment implements View.OnClickListener{ // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_profile, container, false); findViews(view); + Glide.with(this).using(new FirebaseImageLoader()).load(httpsReference).into(profilePicture); return view; } diff --git a/app/MyHyvesBookPlusStagram/app/src/main/res/layout/fragment_profile.xml b/app/MyHyvesBookPlusStagram/app/src/main/res/layout/fragment_profile.xml index bb2fadd..aae3ae2 100644 --- a/app/MyHyvesBookPlusStagram/app/src/main/res/layout/fragment_profile.xml +++ b/app/MyHyvesBookPlusStagram/app/src/main/res/layout/fragment_profile.xml @@ -5,42 +5,43 @@ android:layout_height="match_parent" tools:context="nl.myhyvesbookplus.tagram.ProfileFragment"> - - + android:layout_height="wrap_content" + android:orientation="vertical"> - + android:gravity="center_horizontal" + android:textSize="25sp" + android:textStyle="bold" + android:text="Name:" /> -