Merge remote-tracking branch 'origin/master' into niels-profile
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package nl.myhyvesbookplus.tagram;
|
||||
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -33,25 +34,25 @@ public class MainActivity extends AppCompatActivity implements CameraFragment.On
|
||||
case nl.myhyvesbookplus.tagram.R.id.navigation_timeline:
|
||||
Log.d(TAG, "onNavigationItemSelected: Timeline");
|
||||
TimelineFragment timeline = new TimelineFragment();
|
||||
transaction.replace(R.id.content, timeline);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
transaction.replace(R.id.content, timeline)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
return true;
|
||||
|
||||
case nl.myhyvesbookplus.tagram.R.id.navigation_camera:
|
||||
Log.d(TAG, "onNavigationItemSelected: Camera");
|
||||
CameraFragment camera = new CameraFragment();
|
||||
transaction.replace(R.id.content, camera);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
transaction.replace(R.id.content, camera)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
return true;
|
||||
|
||||
case nl.myhyvesbookplus.tagram.R.id.navigation_profile:
|
||||
Log.d(TAG, "onNavigationItemSelected: Profile");
|
||||
ProfileFragment profile = new ProfileFragment();
|
||||
transaction.replace(R.id.content, profile);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
transaction.replace(R.id.content, profile)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -110,6 +111,13 @@ public class MainActivity extends AppCompatActivity implements CameraFragment.On
|
||||
@Override
|
||||
public void ProfilePictureUpdated(Boolean success) {
|
||||
Log.d(TAG, "ProfilePictureUpdated: Ja ik luister naar je!");
|
||||
FragmentManager man = getFragmentManager();
|
||||
ProfileFragment frag = (ProfileFragment) man.findFragmentById(R.id.content);
|
||||
FragmentTransaction transaction = man.beginTransaction();
|
||||
transaction.detach(frag)
|
||||
.attach(frag)
|
||||
.commit();
|
||||
Log.d(TAG, "ProfilePictureUpdated: Done reloading fragment");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,9 +91,6 @@ public class ProfileFragment extends Fragment implements View.OnClickListener {
|
||||
}
|
||||
|
||||
user = FirebaseAuth.getInstance().getCurrentUser();
|
||||
if (user != null && user.getPhotoUrl() != null) {
|
||||
httpsReference = FirebaseStorage.getInstance().getReferenceFromUrl(user.getPhotoUrl().toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,10 +118,16 @@ public class ProfileFragment extends Fragment implements View.OnClickListener {
|
||||
View view = inflater.inflate(R.layout.fragment_profile, container, false);
|
||||
findViews(view);
|
||||
|
||||
if (user != null && user.getPhotoUrl() != null) {
|
||||
httpsReference = FirebaseStorage.getInstance().getReferenceFromUrl(user.getPhotoUrl().toString());
|
||||
}
|
||||
|
||||
if (httpsReference != null) {
|
||||
Glide.with(this).using(new FirebaseImageLoader()).load(httpsReference).into(profilePicture);
|
||||
}
|
||||
|
||||
profilePicture.invalidate();
|
||||
|
||||
if (user != null && user.getDisplayName() != null) {
|
||||
profileName.setText(user.getDisplayName());
|
||||
}
|
||||
@@ -188,7 +191,6 @@ public class ProfileFragment extends Fragment implements View.OnClickListener {
|
||||
Bitmap imageBitmap = (Bitmap) extras.get("data");
|
||||
UploadClass uploadClass = new UploadClass(getActivity());
|
||||
uploadClass.uploadProfilePicture(imageBitmap);
|
||||
profilePicture.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,6 +251,4 @@ public class ProfileFragment extends Fragment implements View.OnClickListener {
|
||||
// TODO: Update argument type and name
|
||||
void onFragmentInteraction(Uri uri);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user