Merge branch 'marijn-appje' into 'master'
Marijn appje See merge request !10
This commit was merged in pull request #10.
This commit is contained in:
@@ -26,10 +26,11 @@ 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: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.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-database:11.0.1'
|
||||||
|
compile 'com.google.firebase:firebase-auth:11.0.1'
|
||||||
compile 'com.google.firebase:firebase-storage:11.0.1'
|
compile 'com.google.firebase:firebase-storage:11.0.1'
|
||||||
|
|
||||||
// FirebaseUI Storage only
|
// FirebaseUI Storage only
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package nl.myhyvesbookplus.tagram;
|
|||||||
import android.app.FragmentManager;
|
import android.app.FragmentManager;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
import android.hardware.Camera;
|
import android.hardware.Camera;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -16,6 +17,8 @@ import android.view.View;
|
|||||||
|
|
||||||
import com.google.firebase.auth.FirebaseAuth;
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
|
|
||||||
|
import nl.myhyvesbookplus.tagram.model.BitmapPost;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements CameraFragment.OnFragmentInteractionListener, ProfileFragment.OnFragmentInteractionListener, TimelineFragment.OnFragmentInteractionListener {
|
public class MainActivity extends AppCompatActivity implements CameraFragment.OnFragmentInteractionListener, ProfileFragment.OnFragmentInteractionListener, TimelineFragment.OnFragmentInteractionListener {
|
||||||
final static private String TAG = "MainScreen";
|
final static private String TAG = "MainScreen";
|
||||||
|
|
||||||
@@ -71,6 +74,8 @@ public class MainActivity extends AppCompatActivity implements CameraFragment.On
|
|||||||
goToLogin();
|
goToLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.d(TAG, "onCreate: " + mAuth.getCurrentUser().getPhotoUrl() );
|
||||||
|
|
||||||
TimelineFragment fragment = new TimelineFragment();
|
TimelineFragment fragment = new TimelineFragment();
|
||||||
|
|
||||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||||
@@ -92,11 +97,18 @@ public class MainActivity extends AppCompatActivity implements CameraFragment.On
|
|||||||
public void logOutOnClick(View view) {
|
public void logOutOnClick(View view) {
|
||||||
FirebaseAuth.getInstance().signOut();
|
FirebaseAuth.getInstance().signOut();
|
||||||
goToLogin();
|
goToLogin();
|
||||||
this.finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void goToLogin() {
|
protected void goToLogin() {
|
||||||
Intent goToLogIn = new Intent(this, LoginActivity.class);
|
Intent goToLogIn = new Intent(this, LoginActivity.class);
|
||||||
startActivity(goToLogIn);
|
startActivity(goToLogIn);
|
||||||
|
this.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCreatePost(View view) {
|
||||||
|
UploadClass uploadClass = new UploadClass();
|
||||||
|
Bitmap bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ALPHA_8);
|
||||||
|
BitmapPost bitmapPost = new BitmapPost(bitmap, "Dit is een Test!");
|
||||||
|
uploadClass.uploadPicture(bitmapPost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
package nl.myhyvesbookplus.tagram;
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.app.Fragment;
|
import android.provider.MediaStore;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.util.Log;
|
|
||||||
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.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
@@ -25,9 +26,7 @@ import com.google.firebase.auth.FirebaseUser;
|
|||||||
import com.google.firebase.storage.FirebaseStorage;
|
import com.google.firebase.storage.FirebaseStorage;
|
||||||
import com.google.firebase.storage.StorageReference;
|
import com.google.firebase.storage.StorageReference;
|
||||||
|
|
||||||
import org.w3c.dom.Text;
|
import static android.app.Activity.RESULT_OK;
|
||||||
|
|
||||||
import static android.content.ContentValues.TAG;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
@@ -38,25 +37,24 @@ import static android.content.ContentValues.TAG;
|
|||||||
* create an instance of this fragment.
|
* create an instance of this fragment.
|
||||||
*/
|
*/
|
||||||
public class ProfileFragment extends Fragment implements View.OnClickListener {
|
public class ProfileFragment extends Fragment implements View.OnClickListener {
|
||||||
|
static final int REQUEST_IMAGE_CAPTURE = 1;
|
||||||
// TODO: Rename parameter arguments, choose names that match
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
private static final String ARG_PARAM1 = "param1";
|
private static final String ARG_PARAM1 = "param1";
|
||||||
private static final String ARG_PARAM2 = "param2";
|
private static final String ARG_PARAM2 = "param2";
|
||||||
|
private static Uri downloadUrl;
|
||||||
// TODO: Rename and change types of parameters
|
|
||||||
private String mParam1;
|
|
||||||
private String mParam2;
|
|
||||||
|
|
||||||
/// Views ///
|
|
||||||
|
|
||||||
protected Button changePwdButton;
|
protected Button changePwdButton;
|
||||||
protected ImageButton profilePicButton;
|
protected ImageButton profilePicButton;
|
||||||
|
|
||||||
|
/// Views ///
|
||||||
protected StorageReference httpsReference;
|
protected StorageReference httpsReference;
|
||||||
protected TextView profileName;
|
protected TextView profileName;
|
||||||
protected ImageView profilePicture;
|
protected ImageView profilePicture;
|
||||||
|
|
||||||
private OnFragmentInteractionListener mListener;
|
|
||||||
protected FirebaseUser user;
|
protected FirebaseUser user;
|
||||||
|
// TODO: Rename and change types of parameters
|
||||||
|
private String mParam1;
|
||||||
|
private String mParam2;
|
||||||
|
private OnFragmentInteractionListener mListener;
|
||||||
|
|
||||||
/// Required empty public constructor ///
|
/// Required empty public constructor ///
|
||||||
|
|
||||||
@@ -124,7 +122,6 @@ public class ProfileFragment extends Fragment implements View.OnClickListener {
|
|||||||
Glide.with(this).using(new FirebaseImageLoader()).load(httpsReference).into(profilePicture);
|
Glide.with(this).using(new FirebaseImageLoader()).load(httpsReference).into(profilePicture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Remove check for getDisplayName if all users are required to enter a displayName anyways.
|
|
||||||
if (user != null && user.getDisplayName() != null) {
|
if (user != null && user.getDisplayName() != null) {
|
||||||
profileName.setText(user.getDisplayName());
|
profileName.setText(user.getDisplayName());
|
||||||
}
|
}
|
||||||
@@ -161,9 +158,56 @@ public class ProfileFragment extends Fragment implements View.OnClickListener {
|
|||||||
* Performs profile picture change action.
|
* Performs profile picture change action.
|
||||||
*/
|
*/
|
||||||
public void profilePicOnClick() {
|
public void profilePicOnClick() {
|
||||||
Log.d(TAG, "profilePicOnClick: JE KAN NOG GEEN FOTO UPLOADEN");
|
// Log.d(TAG, "profilePicOnClick: JE KAN NOG GEEN FOTO UPLOADEN");
|
||||||
|
dispatchTakePictureIntent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts new intent for access to the built-in camera of device.
|
||||||
|
*/
|
||||||
|
private void dispatchTakePictureIntent() {
|
||||||
|
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
|
||||||
|
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grabs the image just taken by the built-in camera and pushes this image to the user account.
|
||||||
|
* @param requestCode
|
||||||
|
* @param resultCode
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
|
||||||
|
Bundle extras = data.getExtras();
|
||||||
|
Bitmap imageBitmap = (Bitmap) extras.get("data");
|
||||||
|
UploadClass uploadClass = new UploadClass();
|
||||||
|
uploadClass.uploadProfilePicture(imageBitmap);
|
||||||
|
// uploadClass.uploadPicture(new BitmapPost(imageBitmap, "Ik ben een heel mooi comment"));
|
||||||
|
// downloadUrl = uploadClass.getDownloadUrl();
|
||||||
|
// updateUserProfilePic(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// protected void updateUserProfilePic(final FirebaseUser user) {
|
||||||
|
// UserProfileChangeRequest request = new UserProfileChangeRequest.Builder()
|
||||||
|
// .setPhotoUri(downloadUrl)
|
||||||
|
// .build();
|
||||||
|
//
|
||||||
|
// user.updateProfile(request)
|
||||||
|
// .addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
// @Override
|
||||||
|
// public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
// if (task.isSuccessful()) {
|
||||||
|
// Log.d(TAG, "User profile updated!");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
// TODO Make this function into its own class for modularity.
|
// TODO Make this function into its own class for modularity.
|
||||||
/**
|
/**
|
||||||
* Performs password reset action.
|
* Performs password reset action.
|
||||||
|
|||||||
@@ -3,49 +3,83 @@ package nl.myhyvesbookplus.tagram;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
import com.google.android.gms.tasks.OnFailureListener;
|
import com.google.android.gms.tasks.OnFailureListener;
|
||||||
import com.google.android.gms.tasks.OnSuccessListener;
|
import com.google.android.gms.tasks.OnSuccessListener;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
import com.google.firebase.auth.FirebaseAuth;
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
import com.google.firebase.auth.FirebaseUser;
|
import com.google.firebase.auth.FirebaseUser;
|
||||||
|
import com.google.firebase.auth.UserProfileChangeRequest;
|
||||||
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.database.FirebaseDatabase;
|
||||||
import com.google.firebase.storage.FirebaseStorage;
|
import com.google.firebase.storage.FirebaseStorage;
|
||||||
import com.google.firebase.storage.StorageReference;
|
import com.google.firebase.storage.StorageReference;
|
||||||
import com.google.firebase.storage.UploadTask;
|
import com.google.firebase.storage.UploadTask;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
|
import nl.myhyvesbookplus.tagram.model.BitmapPost;
|
||||||
|
import nl.myhyvesbookplus.tagram.model.UriPost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by marijnjansen on 20/06/2017.
|
* Created by marijnjansen on 20/06/2017.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class UploadClass {
|
public class UploadClass {
|
||||||
|
|
||||||
|
private static final String TAG = "UploadClass";
|
||||||
private StorageReference mStorageRef;
|
private StorageReference mStorageRef;
|
||||||
|
private DatabaseReference mDataRef;
|
||||||
|
|
||||||
public UploadClass() {
|
public UploadClass() {
|
||||||
mStorageRef = FirebaseStorage.getInstance().getReference().child("images");
|
mStorageRef = FirebaseStorage.getInstance().getReference();
|
||||||
|
mDataRef = FirebaseDatabase.getInstance().getReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Helpers ///
|
||||||
|
|
||||||
private byte[] bitmapToBytes(Bitmap bitmap) {
|
private byte[] bitmapToBytes(Bitmap bitmap) {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
|
||||||
return baos.toByteArray();
|
return baos.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uploadPicture(Bitmap bitmap) {
|
/// Post Uploads ///
|
||||||
UploadTask uploadTask = mStorageRef.putBytes(bitmapToBytes(bitmap));
|
|
||||||
|
public void uploadPicture(final BitmapPost post) {
|
||||||
|
|
||||||
|
|
||||||
|
UploadTask uploadTask = mStorageRef.child("posts").child("UniquePostName" + ".jpg").putBytes(bitmapToBytes(post.getBitmap()));
|
||||||
uploadTask.addOnFailureListener(new OnFailureListener() {
|
uploadTask.addOnFailureListener(new OnFailureListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Exception e) {
|
public void onFailure(@NonNull Exception e) {
|
||||||
|
Log.d(TAG, "onFailure: Upload Failed");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
|
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
|
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
|
||||||
// Handle successful uploads on complete
|
// Handle successful uploads on complete
|
||||||
|
Log.d(TAG, "onSuccess: Upload Success!");
|
||||||
Uri downloadUrl = taskSnapshot.getMetadata().getDownloadUrl();
|
Uri downloadUrl = taskSnapshot.getMetadata().getDownloadUrl();
|
||||||
|
putPostInDatabase(post.getUriPost(downloadUrl));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void putPostInDatabase(UriPost post) {
|
||||||
|
DatabaseReference ref = mDataRef.child("posts").child("UniquePostName"); // TODO: Naam voor post.
|
||||||
|
ref.setValue(post) // FIXME: Grote boos veroorzaker
|
||||||
|
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
if (task.isSuccessful()) {
|
||||||
|
Log.d(TAG, "onComplete: Added post to database");
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "onComplete: " + task.getException().getLocalizedMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -57,4 +91,32 @@ public class UploadClass {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Profile picture ///
|
||||||
|
|
||||||
|
protected void uploadProfilePicture(Bitmap picture) {
|
||||||
|
byte[] uploadPhoto = bitmapToBytes(picture);
|
||||||
|
UploadTask photoUpload = mStorageRef.child("profile").child(getUserUid()).putBytes(uploadPhoto);
|
||||||
|
photoUpload.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
|
||||||
|
Uri downloadUrl = taskSnapshot.getDownloadUrl();
|
||||||
|
updateProfilePictureInUser(downloadUrl);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateProfilePictureInUser(Uri url) {
|
||||||
|
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
|
||||||
|
UserProfileChangeRequest request = new UserProfileChangeRequest.Builder()
|
||||||
|
.setPhotoUri(url)
|
||||||
|
.build();
|
||||||
|
user.updateProfile(request)
|
||||||
|
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
Log.d(TAG, "onComplete: Updated profile picture");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.model;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class BitmapPost extends Post {
|
||||||
|
private Bitmap photo;
|
||||||
|
|
||||||
|
public BitmapPost(Bitmap photo, String comment, Date date, int nietSlechts, String poster) {
|
||||||
|
super(comment, date, nietSlechts, poster);
|
||||||
|
this.photo = photo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BitmapPost(Bitmap photo, String comment) {
|
||||||
|
super(comment);
|
||||||
|
this.photo = photo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bitmap getBitmap() {
|
||||||
|
return photo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UriPost getUriPost(Uri url) {
|
||||||
|
return new UriPost(url, getComment(), getDate(), getNietSlechts(), getPoster());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoto(Bitmap photo) {
|
||||||
|
this.photo = photo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.model;
|
||||||
|
|
||||||
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by marijnjansen on 22/06/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract class Post {
|
||||||
|
|
||||||
|
private Date date;
|
||||||
|
private String comment;
|
||||||
|
private int nietSlechts;
|
||||||
|
private String poster;
|
||||||
|
|
||||||
|
Post() {
|
||||||
|
// Default constructor required for calls to Post.getValue(User.class)
|
||||||
|
}
|
||||||
|
|
||||||
|
Post(String comment, Date date, int nietSlechts, String poster) {
|
||||||
|
this.date = date;
|
||||||
|
this.comment = comment;
|
||||||
|
this.nietSlechts = nietSlechts;
|
||||||
|
this.poster = poster;
|
||||||
|
}
|
||||||
|
|
||||||
|
Post(String comment) {
|
||||||
|
this(comment, new Date(), 0, FirebaseAuth.getInstance().getCurrentUser().getUid());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNietSlechts() {
|
||||||
|
return nietSlechts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNietSlechts(int nietSlechts) {
|
||||||
|
this.nietSlechts = nietSlechts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPoster() {
|
||||||
|
return poster;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoster(String poster) {
|
||||||
|
this.poster = poster;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.model;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class UriPost extends Post {
|
||||||
|
private String photo;
|
||||||
|
|
||||||
|
public UriPost() {
|
||||||
|
// Default constructor required for calls to DataSnapshot.getValue(UriPost.class)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UriPost(Uri photo, String comment, Date date, int nietSlechts, String poster) {
|
||||||
|
super(comment, date, nietSlechts, poster);
|
||||||
|
this.photo = photo.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UriPost(String photo, String comment) {
|
||||||
|
super(comment);
|
||||||
|
this.photo = photo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return photo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoto(String photo) {
|
||||||
|
this.photo = photo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,5 +9,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:text="@string/hello_blank_fragment" />
|
android:text="@string/hello_blank_fragment" />
|
||||||
|
<Button
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Test bitmap upload"
|
||||||
|
android:onClick="testCreatePost"/>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user