first implementation of profile picture
This commit is contained in:
@@ -26,11 +26,14 @@ dependencies {
|
|||||||
})
|
})
|
||||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||||
compile 'com.android.support:design: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-database:11.0.1'
|
||||||
compile 'com.google.firebase:firebase-auth:10.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.constraint:constraint-layout:1.0.2'
|
||||||
compile 'com.android.support:support-v4:25.3.1'
|
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'
|
testCompile 'junit:junit:4.12'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,14 @@ import android.app.Fragment;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,6 +41,9 @@ public class ProfileFragment extends Fragment implements View.OnClickListener{
|
|||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected StorageReference httpsReference;
|
||||||
|
protected ImageView profilePicture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this factory method to create a new instance of
|
* Use this factory method to create a new instance of
|
||||||
* this fragment using the provided parameters.
|
* this fragment using the provided parameters.
|
||||||
@@ -63,13 +74,28 @@ public class ProfileFragment extends Fragment implements View.OnClickListener{
|
|||||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
|
||||||
|
if (user != null) {
|
||||||
|
httpsReference = FirebaseStorage.getInstance().getReferenceFromUrl(user.getPhotoUrl().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void findViews(View view) {
|
||||||
|
profilePicture = (ImageView) view.findViewById(R.id.imageView_profile_picture);
|
||||||
|
bindOnClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
return inflater.inflate(R.layout.fragment_profile, container, false);
|
|
||||||
|
View view = inflater.inflate(R.layout.fragment_profile, container, false);
|
||||||
|
findViews(view);
|
||||||
|
Glide.with(this).using(new FirebaseImageLoader()).load(httpsReference).into(profilePicture);
|
||||||
|
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Rename method, update argument and hook method into UI event
|
// TODO: Rename method, update argument and hook method into UI event
|
||||||
|
|||||||
@@ -5,10 +5,6 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="nl.myhyvesbookplus.tagram.ProfileFragment">
|
tools:context="nl.myhyvesbookplus.tagram.ProfileFragment">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
@@ -18,29 +14,34 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/profile-name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:textSize="25sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="Name:" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/logout_button"
|
android:id="@+id/logout_button"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="50dp"
|
||||||
android:layout_weight="1"
|
|
||||||
android:onClick="logOutOnClick"
|
android:onClick="logOutOnClick"
|
||||||
android:text="@string/logout_button" />
|
android:text="@string/logout_button" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView_profile_picture"
|
android:id="@+id/imageView_profile_picture"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="300dp"
|
||||||
android:layout_weight="1"
|
|
||||||
app:srcCompat="@drawable/ic_account_box_black_24dp" />
|
app:srcCompat="@drawable/ic_account_box_black_24dp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/profile_pic_button"
|
android:id="@+id/profile_pic_button"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="50dp"
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/profile_picture_button" />
|
android:text="@string/profile_picture_button" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</LinearLayout>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user