Compare commits
129 Commits
niels-notu
...
marijn-app
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7936350ede | ||
|
|
c517c2ef10 | ||
|
|
c9eb4b62a1 | ||
|
|
71d412beac | ||
|
|
af47900288 | ||
|
|
5ae1d1f964 | ||
|
|
c8f65c0dca | ||
|
|
0560e6a0fb | ||
|
|
93434a981f | ||
|
|
2621062c60 | ||
|
|
43a1fcd52c | ||
|
|
982d7d4279 | ||
|
|
a04866ba3f | ||
|
|
f1befdd21c | ||
|
|
cab6728a54 | ||
|
|
017b5890c2 | ||
|
|
fe15764d2b | ||
|
|
bfd018ad4a | ||
|
|
ba832682bf | ||
|
|
f0719c51f9 | ||
|
|
3aab463143 | ||
|
|
2db1254750 | ||
|
|
16c3b727fc | ||
|
|
d3395f3e9b | ||
|
|
7ed5c36884 | ||
|
|
0c3ed94bb7 | ||
|
|
744ab1a9c0 | ||
|
|
b11cc95000 | ||
|
|
cebc1bd59b | ||
|
|
1d3537cdde | ||
|
|
6851009e4b | ||
|
|
08849521e1 | ||
|
|
046e3f9400 | ||
|
|
ab0b105640 | ||
|
|
2b7965ad61 | ||
|
|
726129db5b | ||
|
|
f60005c29d | ||
|
|
9322840d10 | ||
|
|
1c9da2c8dc | ||
|
|
0b943e3a1a | ||
|
|
84353046a5 | ||
|
|
2ad161049a | ||
|
|
d3558b6344 | ||
|
|
2db99500af | ||
|
|
350e55271e | ||
|
|
3f00e09592 | ||
|
|
2c40a1b8da | ||
|
|
0136868ea8 | ||
|
|
b20534aaec | ||
|
|
507fac220c | ||
|
|
d4d10e3f6f | ||
|
|
035f94ec66 | ||
|
|
6142e93957 | ||
|
|
247a443aba | ||
|
|
e54e423847 | ||
|
|
03d4244daf | ||
|
|
766711faee | ||
|
|
046b04e83a | ||
|
|
801acc24fa | ||
|
|
d3d5a41037 | ||
|
|
d90a878a58 | ||
|
|
a9ad130866 | ||
|
|
c2582c128a | ||
|
|
8678cc9111 | ||
|
|
cc1b83b0e0 | ||
|
|
5181128504 | ||
|
|
83d2bda5c1 | ||
|
|
a71fc80f59 | ||
|
|
da765832f1 | ||
|
|
3855d9d917 | ||
|
|
8ba9f7f8e3 | ||
|
|
6aeacbfc8a | ||
|
|
6d7930ee03 | ||
|
|
c056d96138 | ||
|
|
a8a026d18f | ||
|
|
6e55954dde | ||
|
|
c78f01dbfe | ||
|
|
0e25ff63cc | ||
|
|
b570e5ef21 | ||
|
|
c5c6ba7a47 | ||
|
|
d8eea0bb70 | ||
|
|
0f98bdb5ea | ||
|
|
2a89827b63 | ||
|
|
b0a99b3ab1 | ||
|
|
d7dcaa6c29 | ||
|
|
66221c4393 | ||
|
|
a93f8a500d | ||
|
|
95bb92930e | ||
|
|
e5285f91d5 | ||
|
|
37507c3f5f | ||
|
|
6e08558769 | ||
|
|
a2d333c627 | ||
|
|
aabe207594 | ||
|
|
9a8feee49f | ||
|
|
cd45463f6a | ||
|
|
60e58b40bc | ||
|
|
08ec6e3ee8 | ||
|
|
cafe39d045 | ||
|
|
84a2c75c85 | ||
|
|
63bef257da | ||
|
|
fa3f42da7e | ||
|
|
6faf1c9400 | ||
|
|
d0386a533f | ||
|
|
d326785082 | ||
|
|
fe1960fdce | ||
|
|
4005bef38c | ||
|
|
1a944364c4 | ||
|
|
e48ddd6b82 | ||
|
|
80e2935b23 | ||
|
|
d982c8ba49 | ||
|
|
6db7ca20ae | ||
|
|
e787204ce7 | ||
|
|
72003c75ff | ||
|
|
92bf29dd84 | ||
|
|
bb69d3f695 | ||
|
|
27416aae85 | ||
|
|
c040ef495f | ||
|
|
75d1e6b4ed | ||
|
|
442c5bd642 | ||
|
|
1e5239921a | ||
|
|
f3ee792d22 | ||
|
|
01a27d8a95 | ||
|
|
291261fcee | ||
|
|
3aac4fc96d | ||
|
|
b9ab2676a6 | ||
|
|
bd2b69a330 | ||
|
|
c27b608168 | ||
|
|
720865fd7e | ||
|
|
23db910b92 |
@@ -6,7 +6,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "nl.myhyvesbookplus.tagram"
|
applicationId "nl.myhyvesbookplus.tagram"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 25
|
targetSdkVersion 21
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
@@ -26,10 +26,15 @@ 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-auth:10.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'
|
||||||
|
|
||||||
|
// FirebaseUI Storage only
|
||||||
|
compile 'com.firebaseui:firebase-ui-storage:2.0.1'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,4 +47,5 @@ dependencies {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
@@ -14,6 +14,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "1078950034345-k3mcuf1bkf9ehg7vi09cp16lcdrrpf3a.apps.googleusercontent.com",
|
||||||
|
"client_type": 1,
|
||||||
|
"android_info": {
|
||||||
|
"package_name": "nl.myhyvesbookplus.tagram",
|
||||||
|
"certificate_hash": "02b894113a27cc0c4b6025a382c826477fc8543a"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"client_id": "1078950034345-dmsbu0066sfqgqthn2mldlauvdef98u9.apps.googleusercontent.com",
|
"client_id": "1078950034345-dmsbu0066sfqgqthn2mldlauvdef98u9.apps.googleusercontent.com",
|
||||||
"client_type": 3
|
"client_type": 3
|
||||||
@@ -29,8 +37,13 @@
|
|||||||
"status": 1
|
"status": 1
|
||||||
},
|
},
|
||||||
"appinvite_service": {
|
"appinvite_service": {
|
||||||
"status": 1,
|
"status": 2,
|
||||||
"other_platform_oauth_client": []
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "1078950034345-dmsbu0066sfqgqthn2mldlauvdef98u9.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ads_service": {
|
"ads_service": {
|
||||||
"status": 2
|
"status": 2
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="nl.myhyvesbookplus.tagram">
|
package="nl.myhyvesbookplus.tagram">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
@@ -9,6 +13,18 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="android.support.v4.content.FileProvider"
|
||||||
|
android:authorities="nl.myhyvesbookplus.tagram.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths"/>
|
||||||
|
</provider>
|
||||||
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
|
|||||||
@@ -1,13 +1,28 @@
|
|||||||
package nl.myhyvesbookplus.tagram;
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.hardware.Camera;
|
||||||
|
import android.hardware.Camera.PictureCallback;
|
||||||
|
import android.media.Image;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
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.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
import nl.myhyvesbookplus.tagram.controller.PostUploader;
|
||||||
|
import nl.myhyvesbookplus.tagram.model.BitmapPost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
@@ -17,8 +32,9 @@ import android.view.ViewGroup;
|
|||||||
* Use the {@link CameraFragment#newInstance} factory method to
|
* Use the {@link CameraFragment#newInstance} factory method to
|
||||||
* create an instance of this fragment.
|
* create an instance of this fragment.
|
||||||
*/
|
*/
|
||||||
public class CameraFragment extends Fragment {
|
public class CameraFragment extends Fragment implements PostUploader.PostUploadListener{
|
||||||
// TODO: Rename parameter arguments, choose names that match
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
|
private static final String TAG = "CameraFragment";
|
||||||
// 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";
|
||||||
@@ -29,6 +45,11 @@ public class CameraFragment extends Fragment {
|
|||||||
|
|
||||||
private OnFragmentInteractionListener mListener;
|
private OnFragmentInteractionListener mListener;
|
||||||
|
|
||||||
|
private Camera mCamera;
|
||||||
|
private CameraPreview mPreview;
|
||||||
|
private Bitmap mPhoto;
|
||||||
|
private int facing = Camera.CameraInfo.CAMERA_FACING_BACK;
|
||||||
|
|
||||||
public CameraFragment() {
|
public CameraFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
@@ -64,7 +85,178 @@ public class CameraFragment extends Fragment {
|
|||||||
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_camera, container, false);
|
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
|
||||||
|
getActivity().findViewById(R.id.content).setPadding(0,0,0,0);
|
||||||
|
|
||||||
|
final View view = inflater.inflate(R.layout.fragment_camera, container, false);
|
||||||
|
|
||||||
|
mCamera = getCameraInstance(facing);
|
||||||
|
|
||||||
|
mPreview = new CameraPreview(getActivity().getBaseContext(), mCamera);
|
||||||
|
final RelativeLayout filterButtons = (RelativeLayout) view.findViewById(R.id.filter_buttons);
|
||||||
|
final RelativeLayout mCameraLayout = (RelativeLayout) view.findViewById(R.id.camera_preview);
|
||||||
|
|
||||||
|
mCameraLayout.addView(mPreview);
|
||||||
|
|
||||||
|
// Draw buttons over preview
|
||||||
|
view.findViewById(R.id.picture_button).bringToFront();
|
||||||
|
view.findViewById(R.id.switch_camera_button).bringToFront();
|
||||||
|
filterButtons.bringToFront();
|
||||||
|
|
||||||
|
(view.findViewById(R.id.switch_camera_button)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
switchFacing();
|
||||||
|
|
||||||
|
mCameraLayout.removeView(mPreview);
|
||||||
|
mCamera = getCameraInstance(facing);
|
||||||
|
|
||||||
|
mPreview = new CameraPreview(getActivity().getBaseContext(), mCamera);
|
||||||
|
mCameraLayout.addView(mPreview);
|
||||||
|
|
||||||
|
view.findViewById(R.id.picture_button).bringToFront();
|
||||||
|
view.findViewById(R.id.switch_camera_button).bringToFront();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.picture_button)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
mCamera.takePicture(null, null, new PictureCallback() {
|
||||||
|
@Override
|
||||||
|
public void onPictureTaken(byte[] data, Camera camera) {
|
||||||
|
mPhoto = BitmapFactory.decodeByteArray(data, 0, data.length, null);
|
||||||
|
|
||||||
|
PicturePreview mPicPreview = new PicturePreview(getActivity().getBaseContext(), mPhoto, facing);
|
||||||
|
mPicPreview.setId(R.id.pic_preview);
|
||||||
|
|
||||||
|
mCameraLayout.addView(mPicPreview);
|
||||||
|
|
||||||
|
filterButtons.setVisibility(View.VISIBLE);
|
||||||
|
filterButtons.bringToFront();
|
||||||
|
|
||||||
|
switchButtons(view);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.upload_button)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
view.findViewById(R.id.comment_box).setClickable(true);
|
||||||
|
view.findViewById(R.id.comment_box).setVisibility(View.VISIBLE);
|
||||||
|
view.findViewById(R.id.comment_box).bringToFront();
|
||||||
|
view.findViewById(R.id.filter_buttons).setVisibility(View.GONE);
|
||||||
|
((FloatingActionButton)view.findViewById(R.id.upload_button)).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.comment_submit)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
EditText mComment = (EditText) view.findViewById(R.id.comment_text);
|
||||||
|
|
||||||
|
String comment = mComment.getText().toString();
|
||||||
|
mComment.setText("");
|
||||||
|
|
||||||
|
PostUploader upload = new PostUploader(getActivity());
|
||||||
|
upload.uploadPicture(new BitmapPost(((PicturePreview)view.findViewById(R.id.pic_preview)).getPicture(), comment));
|
||||||
|
|
||||||
|
mPhoto.recycle();
|
||||||
|
|
||||||
|
filterButtons.setVisibility(View.GONE);
|
||||||
|
switchButtons(view);
|
||||||
|
|
||||||
|
mCameraLayout.removeView(mPreview);
|
||||||
|
|
||||||
|
mCamera = getCameraInstance(facing);
|
||||||
|
|
||||||
|
mPreview = new CameraPreview(getActivity().getBaseContext(), mCamera);
|
||||||
|
mCameraLayout.addView(mPreview);
|
||||||
|
|
||||||
|
view.findViewById(R.id.picture_button).bringToFront();
|
||||||
|
view.findViewById(R.id.switch_camera_button).bringToFront();
|
||||||
|
|
||||||
|
mCameraLayout.removeView(view.findViewById(R.id.pic_preview));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.comment_cancel)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
((EditText) view.findViewById(R.id.comment_text)).setText("");
|
||||||
|
|
||||||
|
mPhoto.recycle();
|
||||||
|
|
||||||
|
filterButtons.setVisibility(View.GONE);
|
||||||
|
switchButtons(view);
|
||||||
|
|
||||||
|
mCameraLayout.removeView(mPreview);
|
||||||
|
|
||||||
|
mCamera = getCameraInstance(facing);
|
||||||
|
|
||||||
|
mPreview = new CameraPreview(getActivity().getBaseContext(), mCamera);
|
||||||
|
mCameraLayout.addView(mPreview);
|
||||||
|
|
||||||
|
view.findViewById(R.id.picture_button).bringToFront();
|
||||||
|
view.findViewById(R.id.switch_camera_button).bringToFront();
|
||||||
|
|
||||||
|
mCameraLayout.removeView(view.findViewById(R.id.pic_preview));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.filter_left)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
mCameraLayout.removeView(view.findViewById(R.id.pic_preview));
|
||||||
|
|
||||||
|
PicturePreview.filterPrev();
|
||||||
|
|
||||||
|
PicturePreview mPicPreview = new PicturePreview(getActivity().getBaseContext(), mPhoto, facing);
|
||||||
|
mPicPreview.setId(R.id.pic_preview);
|
||||||
|
|
||||||
|
mCameraLayout.addView(mPicPreview);
|
||||||
|
|
||||||
|
view.findViewById(R.id.upload_button).bringToFront();
|
||||||
|
filterButtons.setVisibility(View.VISIBLE);
|
||||||
|
filterButtons.bringToFront();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.filter_right)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
mCameraLayout.removeView(view.findViewById(R.id.pic_preview));
|
||||||
|
|
||||||
|
PicturePreview.filterNext();
|
||||||
|
|
||||||
|
PicturePreview mPicPreview = new PicturePreview(getActivity().getBaseContext(), mPhoto, facing);
|
||||||
|
mPicPreview.setId(R.id.pic_preview);
|
||||||
|
|
||||||
|
mCameraLayout.addView(mPicPreview);
|
||||||
|
|
||||||
|
view.findViewById(R.id.upload_button).bringToFront();
|
||||||
|
filterButtons.setVisibility(View.VISIBLE);
|
||||||
|
filterButtons.bringToFront();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(view.findViewById(R.id.comment_text)).setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
if (!hasFocus) {
|
||||||
|
hideKeyboard(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hideKeyboard(View view) {
|
||||||
|
InputMethodManager inputMethodManager =(InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
|
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Rename method, update argument and hook method into UI event
|
// TODO: Rename method, update argument and hook method into UI event
|
||||||
@@ -91,6 +283,73 @@ public class CameraFragment extends Fragment {
|
|||||||
mListener = null;
|
mListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
|
||||||
|
int padding = 16;
|
||||||
|
float scale = getResources().getDisplayMetrics().density;
|
||||||
|
int dp = (int) (padding * scale + 0.5f);
|
||||||
|
((AppCompatActivity)getActivity()).getSupportActionBar().show();
|
||||||
|
getActivity().findViewById(R.id.content).setPadding(dp,dp,dp,dp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Camera getCameraInstance(int facing) {
|
||||||
|
Camera c = null;
|
||||||
|
try {
|
||||||
|
c = Camera.open(facing);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.getStackTrace();
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void switchFacing() {
|
||||||
|
if (facing == Camera.CameraInfo.CAMERA_FACING_FRONT)
|
||||||
|
facing = Camera.CameraInfo.CAMERA_FACING_BACK;
|
||||||
|
else
|
||||||
|
facing = Camera.CameraInfo.CAMERA_FACING_FRONT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void switchButtons(View view) {
|
||||||
|
FloatingActionButton upload = (FloatingActionButton) view.findViewById(R.id.upload_button);
|
||||||
|
ImageButton picButton = (ImageButton) view.findViewById(R.id.picture_button);
|
||||||
|
ImageButton switchButton = (ImageButton) view.findViewById(R.id.switch_camera_button);
|
||||||
|
|
||||||
|
if (((Integer)picButton.getVisibility()).equals(View.GONE)) {
|
||||||
|
Log.d(TAG, "switchButtons: GONE");
|
||||||
|
upload.hide();
|
||||||
|
|
||||||
|
picButton.setVisibility(View.VISIBLE);
|
||||||
|
switchButton.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
picButton.bringToFront();
|
||||||
|
switchButton.bringToFront();
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "switchButtons: VISIBLE");
|
||||||
|
upload.bringToFront();
|
||||||
|
upload.show();
|
||||||
|
|
||||||
|
picButton.setVisibility(View.GONE);
|
||||||
|
switchButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void PostUploadComplete(Boolean success) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface must be implemented by activities that contain this
|
* This interface must be implemented by activities that contain this
|
||||||
* fragment to allow an interaction in this fragment to be communicated
|
* fragment to allow an interaction in this fragment to be communicated
|
||||||
@@ -105,4 +364,5 @@ public class CameraFragment extends Fragment {
|
|||||||
// TODO: Update argument type and name
|
// TODO: Update argument type and name
|
||||||
void onFragmentInteraction(Uri uri);
|
void onFragmentInteraction(Uri uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.hardware.Camera;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.SurfaceHolder;
|
||||||
|
import android.view.SurfaceView;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
|
||||||
|
private static String TAG = "CameraPreview";
|
||||||
|
private SurfaceHolder mHolder;
|
||||||
|
private Camera mCamera;
|
||||||
|
|
||||||
|
public CameraPreview(Context context, Camera camera) {
|
||||||
|
super(context);
|
||||||
|
mCamera = camera;
|
||||||
|
mCamera.setDisplayOrientation(90);
|
||||||
|
|
||||||
|
mHolder = getHolder();
|
||||||
|
mHolder.addCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceCreated(SurfaceHolder mHolder) {
|
||||||
|
try {
|
||||||
|
mCamera.setPreviewDisplay(mHolder);
|
||||||
|
mCamera.startPreview();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.getStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||||
|
if (mHolder.getSurface() == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mCamera.stopPreview();
|
||||||
|
} catch (Exception e){
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mCamera.setPreviewDisplay(mHolder);
|
||||||
|
mCamera.startPreview();
|
||||||
|
|
||||||
|
} catch (Exception e){
|
||||||
|
Log.d("camera", "Error starting camera preview: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||||
|
Log.d(TAG, "surfaceDestroyed: CAMERA DESTROYED");
|
||||||
|
mCamera.stopPreview();
|
||||||
|
mCamera.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
package nl.myhyvesbookplus.tagram;
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@@ -18,7 +19,7 @@ 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.auth.UserProfileChangeRequest;
|
||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
public class LoginActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
public static final String TAG = "Login";
|
public static final String TAG = "Login";
|
||||||
|
|
||||||
/// Views ///
|
/// Views ///
|
||||||
@@ -29,6 +30,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
protected FirebaseAuth mAuth;
|
protected FirebaseAuth mAuth;
|
||||||
|
|
||||||
|
private ProgressDialog progressDialog;
|
||||||
|
|
||||||
/// Setup ///
|
/// Setup ///
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -38,11 +41,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
mAuth = FirebaseAuth.getInstance();
|
mAuth = FirebaseAuth.getInstance();
|
||||||
|
|
||||||
findViews();
|
findViews();
|
||||||
}
|
bindOnClick();
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,44 +62,81 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
emailField = (EditText) findViewById(R.id.email);
|
emailField = (EditText) findViewById(R.id.email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void bindOnClick() {
|
||||||
|
registerButton.setOnClickListener(this);
|
||||||
|
backToLoginButton.setOnClickListener(this);
|
||||||
|
goToRegisterButton.setOnClickListener(this);
|
||||||
|
logInButton.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
/// OnClick ///
|
/// OnClick ///
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the logon action.
|
* Called when a view has been clicked.
|
||||||
*
|
*
|
||||||
* @param view
|
* @param v The view that was clicked.
|
||||||
*/
|
*/
|
||||||
public void logInOnClick(View view) {
|
@Override
|
||||||
String emailSting = emailField.getText().toString();
|
public void onClick(View v) {
|
||||||
String passwordSting = passwordField.getText().toString();
|
switch (v.getId()) {
|
||||||
|
case R.id.register_button:
|
||||||
|
registerOnClick();
|
||||||
|
break;
|
||||||
|
case R.id.go_to_register_button:
|
||||||
|
goToRegisterOnClick();
|
||||||
|
break;
|
||||||
|
case R.id.login_button:
|
||||||
|
logInOnClick();
|
||||||
|
break;
|
||||||
|
case R.id.back_to_login_button:
|
||||||
|
backToLoginOnClick();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logIn(emailSting, passwordSting);
|
/**
|
||||||
|
* Performs the logon action.
|
||||||
|
*/
|
||||||
|
public void logInOnClick() {
|
||||||
|
String emailString = emailField.getText().toString();
|
||||||
|
String passwordString = passwordField.getText().toString();
|
||||||
|
|
||||||
|
if (!emailString.isEmpty() && !passwordString.isEmpty()) {
|
||||||
|
logIn(emailString, passwordString);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(LoginActivity.this, R.string.login_error, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the register action.
|
* Performs the register action.
|
||||||
* @param view
|
|
||||||
*/
|
*/
|
||||||
public void registerOnClick(View view) {
|
public void registerOnClick() {
|
||||||
Log.d(TAG, "registerOnClick: ");
|
String emailString = emailField.getText().toString();
|
||||||
|
String usernameString = usernameField.getText().toString();
|
||||||
|
String passwordString = passwordField.getText().toString();
|
||||||
|
String passwordConfirmString = passwordConfirmField.getText().toString();
|
||||||
|
|
||||||
|
if (!emailString.isEmpty() && !usernameString.isEmpty()
|
||||||
|
&& !passwordString.isEmpty() && !passwordConfirmString.isEmpty()) {
|
||||||
if (passwordField.getText().toString().equals(passwordConfirmField.getText().toString())) {
|
if (passwordField.getText().toString().equals(passwordConfirmField.getText().toString())) {
|
||||||
registerUser(emailField.getText().toString(), passwordField.getText().toString());
|
registerUser(emailField.getText().toString(), passwordField.getText().toString());
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(LoginActivity.this, "Passwords do not match",
|
Toast.makeText(LoginActivity.this, R.string.password_match_error,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
Log.d(TAG, "registerOnClick: Passwords do not match");
|
Log.d(TAG, "registerOnClick: Passwords do not match");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(LoginActivity.this, R.string.register_error, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// UI-changes ///
|
/// UI-changes ///
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the Activity for registering.
|
* Changes the Activity for registering.
|
||||||
* @param view
|
|
||||||
*/
|
*/
|
||||||
public void goToRegisterOnClick(View view) {
|
public void goToRegisterOnClick() {
|
||||||
passwordConfirmField.setVisibility(View.VISIBLE);
|
passwordConfirmField.setVisibility(View.VISIBLE);
|
||||||
passwordConfirmLabel.setVisibility(View.VISIBLE);
|
passwordConfirmLabel.setVisibility(View.VISIBLE);
|
||||||
registerButton.setVisibility(View.VISIBLE);
|
registerButton.setVisibility(View.VISIBLE);
|
||||||
@@ -114,9 +150,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the Activity for logging in.
|
* Changes the Activity for logging in.
|
||||||
* @param view
|
|
||||||
*/
|
*/
|
||||||
public void backToLoginOnClick(View view) {
|
public void backToLoginOnClick() {
|
||||||
passwordConfirmField.setVisibility(View.GONE);
|
passwordConfirmField.setVisibility(View.GONE);
|
||||||
passwordConfirmLabel.setVisibility(View.GONE);
|
passwordConfirmLabel.setVisibility(View.GONE);
|
||||||
registerButton.setVisibility(View.GONE);
|
registerButton.setVisibility(View.GONE);
|
||||||
@@ -134,6 +169,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
protected void goToMainScreen() {
|
protected void goToMainScreen() {
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
progressDialog.dismiss();
|
||||||
this.finish();
|
this.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,11 +177,13 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the actual login action.
|
* Performs the actual login action.
|
||||||
* @param emailSting email address
|
* @param emailString email address
|
||||||
* @param passwordSting the entered password
|
* @param passwordString the entered password
|
||||||
*/
|
*/
|
||||||
protected void logIn(String emailSting, String passwordSting) {
|
protected void logIn(String emailString, String passwordString) {
|
||||||
mAuth.signInWithEmailAndPassword(emailSting, passwordSting)
|
progressDialog = ProgressDialog.show(LoginActivity.this, getString(R.string.please_wait), "Logging in", true, false);
|
||||||
|
|
||||||
|
mAuth.signInWithEmailAndPassword(emailString, passwordString)
|
||||||
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
|
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(@NonNull Task<AuthResult> task) {
|
public void onComplete(@NonNull Task<AuthResult> task) {
|
||||||
@@ -159,6 +197,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
} else {
|
} else {
|
||||||
// If sign in fails, display a message to the user.
|
// If sign in fails, display a message to the user.
|
||||||
Log.w(TAG, "signInWithEmail:failure", task.getException());
|
Log.w(TAG, "signInWithEmail:failure", task.getException());
|
||||||
|
progressDialog.dismiss();
|
||||||
Toast.makeText(LoginActivity.this, task.getException().getLocalizedMessage(),
|
Toast.makeText(LoginActivity.this, task.getException().getLocalizedMessage(),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
@@ -172,6 +211,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
* @param password the entered password
|
* @param password the entered password
|
||||||
*/
|
*/
|
||||||
protected void registerUser(String email, String password) {
|
protected void registerUser(String email, String password) {
|
||||||
|
this.progressDialog = ProgressDialog.show(LoginActivity.this, getString(R.string.please_wait), "Registering", true, false);
|
||||||
mAuth.createUserWithEmailAndPassword(email, password)
|
mAuth.createUserWithEmailAndPassword(email, password)
|
||||||
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
|
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -186,6 +226,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
// If sign in fails, display a message to the user.
|
// If sign in fails, display a message to the user.
|
||||||
Log.w(TAG, "createUserWithEmail:failure", task.getException());
|
Log.w(TAG, "createUserWithEmail:failure", task.getException());
|
||||||
if (task.getException() != null) {
|
if (task.getException() != null) {
|
||||||
|
progressDialog.dismiss();
|
||||||
Toast.makeText(LoginActivity.this, task.getException().getLocalizedMessage(),
|
Toast.makeText(LoginActivity.this, task.getException().getLocalizedMessage(),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
@@ -194,6 +235,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO Make modular for use with Profile fragment.
|
||||||
/**
|
/**
|
||||||
* Saves the Username to Firebase
|
* Saves the Username to Firebase
|
||||||
* @param user The User object that needs to be updated
|
* @param user The User object that needs to be updated
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package nl.myhyvesbookplus.tagram;
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
import android.app.FragmentManager;
|
import android.app.FragmentManager;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -7,7 +8,6 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.BottomNavigationView;
|
import android.support.design.widget.BottomNavigationView;
|
||||||
import android.app.Fragment;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -15,7 +15,14 @@ import android.view.View;
|
|||||||
|
|
||||||
import com.google.firebase.auth.FirebaseAuth;
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements CameraFragment.OnFragmentInteractionListener, ProfileFragment.OnFragmentInteractionListener, TimelineFragment.OnFragmentInteractionListener {
|
import nl.myhyvesbookplus.tagram.controller.DownloadClass;
|
||||||
|
import nl.myhyvesbookplus.tagram.controller.PostUploader;
|
||||||
|
import nl.myhyvesbookplus.tagram.controller.ProfilePictureUploader;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity implements
|
||||||
|
CameraFragment.OnFragmentInteractionListener,
|
||||||
|
ProfilePictureUploader.ProfilePictureUpdatedListener,
|
||||||
|
DownloadClass.PostDownloadListener, PostUploader.PostUploadListener {
|
||||||
final static private String TAG = "MainScreen";
|
final static private String TAG = "MainScreen";
|
||||||
|
|
||||||
FirebaseAuth mAuth;
|
FirebaseAuth mAuth;
|
||||||
@@ -31,25 +38,25 @@ public class MainActivity extends AppCompatActivity implements CameraFragment.On
|
|||||||
case nl.myhyvesbookplus.tagram.R.id.navigation_timeline:
|
case nl.myhyvesbookplus.tagram.R.id.navigation_timeline:
|
||||||
Log.d(TAG, "onNavigationItemSelected: Timeline");
|
Log.d(TAG, "onNavigationItemSelected: Timeline");
|
||||||
TimelineFragment timeline = new TimelineFragment();
|
TimelineFragment timeline = new TimelineFragment();
|
||||||
transaction.replace(R.id.content, timeline);
|
transaction.replace(R.id.content, timeline)
|
||||||
transaction.addToBackStack(null);
|
.addToBackStack(null)
|
||||||
transaction.commit();
|
.commit();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case nl.myhyvesbookplus.tagram.R.id.navigation_camera:
|
case nl.myhyvesbookplus.tagram.R.id.navigation_camera:
|
||||||
Log.d(TAG, "onNavigationItemSelected: Camera");
|
Log.d(TAG, "onNavigationItemSelected: Camera");
|
||||||
CameraFragment camera = new CameraFragment();
|
CameraFragment camera = new CameraFragment();
|
||||||
transaction.replace(R.id.content, camera);
|
transaction.replace(R.id.content, camera)
|
||||||
transaction.addToBackStack(null);
|
.addToBackStack(null)
|
||||||
transaction.commit();
|
.commit();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case nl.myhyvesbookplus.tagram.R.id.navigation_profile:
|
case nl.myhyvesbookplus.tagram.R.id.navigation_profile:
|
||||||
Log.d(TAG, "onNavigationItemSelected: Profile");
|
Log.d(TAG, "onNavigationItemSelected: Profile");
|
||||||
ProfileFragment profile = new ProfileFragment();
|
ProfileFragment profile = new ProfileFragment();
|
||||||
transaction.replace(R.id.content, profile);
|
transaction.replace(R.id.content, profile)
|
||||||
transaction.addToBackStack(null);
|
.addToBackStack(null)
|
||||||
transaction.commit();
|
.commit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -75,7 +82,6 @@ public class MainActivity extends AppCompatActivity implements CameraFragment.On
|
|||||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||||
transaction.replace(R.id.content, fragment);
|
transaction.replace(R.id.content, fragment);
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -91,11 +97,42 @@ 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
@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();
|
||||||
|
frag.progressDialog.dismiss();
|
||||||
|
transaction.detach(frag)
|
||||||
|
.attach(frag)
|
||||||
|
.commit();
|
||||||
|
Log.d(TAG, "ProfilePictureUpdated: Done reloading fragment");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void PostDownloaded() {
|
||||||
|
FragmentManager fragmentManager = getFragmentManager();
|
||||||
|
Fragment frag = fragmentManager.findFragmentById(R.id.content);
|
||||||
|
Log.d(TAG, "PostDownloaded: " + R.id.content);
|
||||||
|
|
||||||
|
if (frag instanceof ProfileFragment) {
|
||||||
|
((ProfileFragment) frag).startList();
|
||||||
|
} else if (frag instanceof TimelineFragment) {
|
||||||
|
((TimelineFragment) frag).startList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void PostUploadComplete(Boolean success) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.ColorFilter;
|
||||||
|
import android.graphics.ColorMatrix;
|
||||||
|
import android.graphics.ColorMatrixColorFilter;
|
||||||
|
import android.graphics.Matrix;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.hardware.Camera;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.SurfaceHolder;
|
||||||
|
import android.view.SurfaceView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by felix on 23/06/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PicturePreview extends SurfaceView implements SurfaceHolder.Callback {
|
||||||
|
private static final String TAG = "PicturePreveiew";
|
||||||
|
private static final int FILTER_NONE = 0;
|
||||||
|
private static final int FILTER_SEPIA = 1;
|
||||||
|
private static final int FILTER_BW = 2;
|
||||||
|
private static final int FILTER_NEG = 3;
|
||||||
|
|
||||||
|
private static int currentFilter = FILTER_NONE;
|
||||||
|
|
||||||
|
int facing;
|
||||||
|
int rotate;
|
||||||
|
Bitmap picture;
|
||||||
|
Bitmap filterPicture;
|
||||||
|
|
||||||
|
public PicturePreview(Context context, Bitmap bmp, int facing) {
|
||||||
|
super(context);
|
||||||
|
setWillNotDraw(false);
|
||||||
|
|
||||||
|
this.facing = facing;
|
||||||
|
|
||||||
|
if (((Integer)facing).equals(Camera.CameraInfo.CAMERA_FACING_FRONT)) {
|
||||||
|
picture = Bitmap.createBitmap(bmp);
|
||||||
|
rotate = 270;
|
||||||
|
} else {
|
||||||
|
picture = Bitmap.createScaledBitmap(bmp, bmp.getWidth() / 2, bmp.getHeight() / 2, false);
|
||||||
|
rotate = 90;
|
||||||
|
}
|
||||||
|
Log.d(TAG, "PicturePreview: " + bmp.getWidth() + " " + bmp.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw(Canvas canvas) {
|
||||||
|
super.onDraw(canvas);
|
||||||
|
ColorMatrix cm = new ColorMatrix();
|
||||||
|
Paint paint = new Paint();
|
||||||
|
ColorMatrixColorFilter filter;
|
||||||
|
Canvas saveCanvas = new Canvas();
|
||||||
|
|
||||||
|
switch (currentFilter) {
|
||||||
|
case FILTER_NONE:
|
||||||
|
canvas.drawBitmap(rotate(picture, rotate), 0, 0, null);
|
||||||
|
filterPicture = rotate(picture, rotate);
|
||||||
|
break;
|
||||||
|
case FILTER_SEPIA:
|
||||||
|
filterPicture = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
|
Log.d(TAG, "onDraw: " + Integer.toString(canvas.getWidth()));
|
||||||
|
|
||||||
|
float[] sepia = {0.393f,0.769f,0.189f,0f,0f,
|
||||||
|
0.349f,0.686f,0.168f,0f,0f,
|
||||||
|
0.272f,0.534f,0.131f,0f,0f,
|
||||||
|
0f, 0f, 0f, 1f, 0f};
|
||||||
|
cm.set(sepia);
|
||||||
|
|
||||||
|
filter = new ColorMatrixColorFilter(cm);
|
||||||
|
paint.setColorFilter(filter);
|
||||||
|
saveCanvas.drawBitmap(rotate(picture, rotate), 0, 0, paint);
|
||||||
|
canvas.drawBitmap(rotate(picture, rotate), 0, 0, paint);
|
||||||
|
break;
|
||||||
|
case FILTER_BW:
|
||||||
|
filterPicture = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
|
|
||||||
|
cm.setSaturation(0);
|
||||||
|
|
||||||
|
filter = new ColorMatrixColorFilter(cm);
|
||||||
|
paint.setColorFilter(filter);
|
||||||
|
saveCanvas.setBitmap(filterPicture);
|
||||||
|
saveCanvas.drawBitmap(rotate(picture, rotate), 0, 0, paint);
|
||||||
|
canvas.drawBitmap(rotate(picture, rotate), 0, 0, paint);
|
||||||
|
break;
|
||||||
|
case FILTER_NEG:
|
||||||
|
filterPicture = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
|
|
||||||
|
float[] neg = {-1f,0f,0f,0f,255f,
|
||||||
|
0f,-1f,0f,0f,255f,
|
||||||
|
0f,0f,-1f,0f,255f,
|
||||||
|
0f,0f,0f,1f,0f};
|
||||||
|
cm.set(neg);
|
||||||
|
|
||||||
|
filter = new ColorMatrixColorFilter(cm);
|
||||||
|
paint.setColorFilter(filter);
|
||||||
|
saveCanvas.setBitmap(filterPicture);
|
||||||
|
saveCanvas.drawBitmap(rotate(picture, rotate), 0, 0, paint);
|
||||||
|
canvas.drawBitmap(rotate(picture, rotate), 0, 0, paint);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void filterPrev() {
|
||||||
|
switch (currentFilter) {
|
||||||
|
case FILTER_NONE:
|
||||||
|
currentFilter = FILTER_NEG;
|
||||||
|
break;
|
||||||
|
case FILTER_SEPIA:
|
||||||
|
currentFilter = FILTER_NONE;
|
||||||
|
break;
|
||||||
|
case FILTER_BW:
|
||||||
|
currentFilter = FILTER_SEPIA;
|
||||||
|
break;
|
||||||
|
case FILTER_NEG:
|
||||||
|
currentFilter = FILTER_BW;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void filterNext() {
|
||||||
|
switch (currentFilter) {
|
||||||
|
case FILTER_NONE:
|
||||||
|
currentFilter = FILTER_SEPIA;
|
||||||
|
break;
|
||||||
|
case FILTER_SEPIA:
|
||||||
|
currentFilter = FILTER_BW;
|
||||||
|
break;
|
||||||
|
case FILTER_BW:
|
||||||
|
currentFilter = FILTER_NEG;
|
||||||
|
break;
|
||||||
|
case FILTER_NEG:
|
||||||
|
currentFilter = FILTER_NONE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Bitmap rotate(Bitmap bmp, int degree) {
|
||||||
|
Matrix mtx = new Matrix();
|
||||||
|
mtx.postRotate(degree);
|
||||||
|
|
||||||
|
return Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), mtx, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bitmap getPicture() {
|
||||||
|
picture.recycle();
|
||||||
|
return filterPicture;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceCreated(SurfaceHolder holder) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||||
|
Log.d(TAG, "surfaceDestroyed: PICTURE DESTROYED");
|
||||||
|
picture.recycle();
|
||||||
|
filterPicture.recycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.firebase.ui.storage.images.FirebaseImageLoader;
|
||||||
|
import com.google.firebase.storage.FirebaseStorage;
|
||||||
|
import com.google.firebase.storage.StorageReference;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import nl.myhyvesbookplus.tagram.model.UriPost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by niels on 27-6-17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ProfileAdapter extends BaseAdapter {
|
||||||
|
|
||||||
|
private static final String TAG = "ProfileAdapter";
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
private Context mContext;
|
||||||
|
private ArrayList<UriPost> mData;
|
||||||
|
private TextView comment;
|
||||||
|
private TextView nietSlechts;
|
||||||
|
private ImageView photo;
|
||||||
|
|
||||||
|
ProfileAdapter(Context context, ArrayList<UriPost> data) {
|
||||||
|
mContext = context;
|
||||||
|
mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
mData = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return mData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return mData.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
View rowView = mInflater.inflate(R.layout.list_item_timeline_profile, parent, false);
|
||||||
|
View newRowView = findViews(rowView);
|
||||||
|
UriPost post = (UriPost) getItem(position);
|
||||||
|
comment.setText(post.getComment());
|
||||||
|
StorageReference ref = FirebaseStorage.getInstance().getReferenceFromUrl(post.getUri());
|
||||||
|
Glide.with(mContext)
|
||||||
|
.using(new FirebaseImageLoader())
|
||||||
|
.load(ref)
|
||||||
|
.into(photo);
|
||||||
|
|
||||||
|
return newRowView;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected View findViews(View rowView) {
|
||||||
|
comment = (TextView) rowView.findViewById(R.id.comment_timeline_profile);
|
||||||
|
nietSlechts = (TextView) rowView.findViewById(R.id.niet_slecht_count_profile);
|
||||||
|
photo = (ImageView) rowView.findViewById(R.id.timeline_image_profile);
|
||||||
|
return rowView;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,108 +1,213 @@
|
|||||||
package nl.myhyvesbookplus.tagram;
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.app.Fragment;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.app.Fragment;
|
import android.os.Environment;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.content.FileProvider;
|
||||||
|
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.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.firebase.ui.storage.images.FirebaseImageLoader;
|
||||||
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
|
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 java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
import nl.myhyvesbookplus.tagram.controller.DownloadClass;
|
||||||
* A simple {@link Fragment} subclass.
|
import nl.myhyvesbookplus.tagram.controller.ProfilePictureUploader;
|
||||||
* Activities that contain this fragment must implement the
|
|
||||||
* {@link ProfileFragment.OnFragmentInteractionListener} interface
|
|
||||||
* to handle interaction events.
|
|
||||||
* Use the {@link ProfileFragment#newInstance} factory method to
|
|
||||||
* create an instance of this fragment.
|
|
||||||
*/
|
|
||||||
public class ProfileFragment extends Fragment {
|
|
||||||
// TODO: Rename parameter arguments, choose names that match
|
|
||||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
|
||||||
private static final String ARG_PARAM1 = "param1";
|
|
||||||
private static final String ARG_PARAM2 = "param2";
|
|
||||||
|
|
||||||
// TODO: Rename and change types of parameters
|
import static android.app.Activity.RESULT_OK;
|
||||||
private String mParam1;
|
|
||||||
private String mParam2;
|
|
||||||
|
|
||||||
private OnFragmentInteractionListener mListener;
|
public class ProfileFragment extends Fragment implements View.OnClickListener {
|
||||||
|
static final int REQUEST_TAKE_PHOTO = 1;
|
||||||
|
|
||||||
public ProfileFragment() {
|
/// Views, buttons and other protected declarations ///
|
||||||
// Required empty public constructor
|
protected Button changePwdButton;
|
||||||
}
|
protected ImageButton profilePicButton;
|
||||||
|
protected StorageReference httpsReference;
|
||||||
|
protected TextView profileName;
|
||||||
|
protected ImageView profilePicture;
|
||||||
|
protected FirebaseUser user;
|
||||||
|
protected File photoFile = null;
|
||||||
|
private ListView listView;
|
||||||
|
private DownloadClass downloadClass;
|
||||||
|
|
||||||
/**
|
ProgressDialog progressDialog;
|
||||||
* Use this factory method to create a new instance of
|
|
||||||
* this fragment using the provided parameters.
|
/// Required empty public constructor ///
|
||||||
*
|
|
||||||
* @param param1 Parameter 1.
|
public ProfileFragment() {}
|
||||||
* @param param2 Parameter 2.
|
|
||||||
* @return A new instance of fragment ProfileFragment.
|
|
||||||
*/
|
|
||||||
// TODO: Rename and change types and number of parameters
|
|
||||||
public static ProfileFragment newInstance(String param1, String param2) {
|
|
||||||
ProfileFragment fragment = new ProfileFragment();
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putString(ARG_PARAM1, param1);
|
|
||||||
args.putString(ARG_PARAM2, param2);
|
|
||||||
fragment.setArguments(args);
|
|
||||||
return fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
if (getArguments() != null) {
|
user = FirebaseAuth.getInstance().getCurrentUser();
|
||||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
|
||||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assigns all views and buttons.
|
||||||
|
*/
|
||||||
|
protected void findViews(View view) {
|
||||||
|
profilePicButton = (ImageButton) view.findViewById(R.id.profile_pic_button);
|
||||||
|
profilePicture = (ImageView) view.findViewById(R.id.imageView_profile_picture);
|
||||||
|
profileName = (TextView) view.findViewById(R.id.profile_name);
|
||||||
|
changePwdButton = (Button) view.findViewById(R.id.change_psw_button);
|
||||||
|
bindOnClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind the buttons to their listeners.
|
||||||
|
*/
|
||||||
|
protected void bindOnClick() {
|
||||||
|
profilePicButton.setOnClickListener(this);
|
||||||
|
changePwdButton.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Page setup ///
|
||||||
|
|
||||||
@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
|
View viewTimeline = inflater.inflate(R.layout.fragment_profile_timeline, container, false);
|
||||||
return inflater.inflate(R.layout.fragment_profile, container, false);
|
|
||||||
|
|
||||||
|
|
||||||
|
listView = (ListView) viewTimeline.findViewById(R.id.listview_profile);
|
||||||
|
View viewHeader = inflater.inflate(R.layout.fragment_profile_header, listView, false);
|
||||||
|
findViews(viewHeader);
|
||||||
|
listView.addHeaderView(viewHeader);
|
||||||
|
|
||||||
|
if (user != null) {
|
||||||
|
if(user.getPhotoUrl() != null) {
|
||||||
|
httpsReference = FirebaseStorage.getInstance().getReferenceFromUrl(user.getPhotoUrl().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Rename method, update argument and hook method into UI event
|
if (user.getDisplayName() != null) {
|
||||||
public void onButtonPressed(Uri uri) {
|
profileName.setText(user.getDisplayName());
|
||||||
if (mListener != null) {
|
|
||||||
mListener.onFragmentInteraction(uri);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
if (httpsReference != null) {
|
||||||
public void onAttach(Context context) {
|
Glide.with(this).using(new FirebaseImageLoader()).load(httpsReference).into(profilePicture);
|
||||||
super.onAttach(context);
|
|
||||||
if (context instanceof OnFragmentInteractionListener) {
|
|
||||||
mListener = (OnFragmentInteractionListener) context;
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException(context.toString()
|
|
||||||
+ " must implement OnFragmentInteractionListener");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
profilePicture.invalidate();
|
||||||
public void onDetach() {
|
|
||||||
super.onDetach();
|
downloadClass = new DownloadClass(getActivity());
|
||||||
mListener = null;
|
downloadClass.getPostsFromServer();
|
||||||
|
|
||||||
|
return viewTimeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface must be implemented by activities that contain this
|
* Called when a view has been clicked.
|
||||||
* fragment to allow an interaction in this fragment to be communicated
|
*
|
||||||
* to the activity and potentially other fragments contained in that
|
* @param v The view that was clicked.
|
||||||
* activity.
|
|
||||||
* <p>
|
|
||||||
* See the Android Training lesson <a href=
|
|
||||||
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
|
||||||
* >Communicating with Other Fragments</a> for more information.
|
|
||||||
*/
|
*/
|
||||||
public interface OnFragmentInteractionListener {
|
@Override
|
||||||
// TODO: Update argument type and name
|
public void onClick(View v) {
|
||||||
void onFragmentInteraction(Uri uri);
|
switch (v.getId()) {
|
||||||
|
case R.id.profile_pic_button:
|
||||||
|
profilePicOnClick();
|
||||||
|
break;
|
||||||
|
case R.id.change_psw_button:
|
||||||
|
changePwdOnClick();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts new intent for access to the built-in camera of device.
|
||||||
|
*/
|
||||||
|
private void profilePicOnClick() {
|
||||||
|
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||||
|
/* Ensure that there's a camera activity to handle the intent */
|
||||||
|
if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
|
||||||
|
/* Create the File where the photo should go */
|
||||||
|
try {
|
||||||
|
photoFile = createImageFile();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Toast.makeText(getActivity(), getString(R.string.image_save_error), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
if (photoFile != null) {
|
||||||
|
Uri photoURI = FileProvider.getUriForFile(getActivity(),
|
||||||
|
"nl.myhyvesbookplus.tagram.fileprovider",
|
||||||
|
photoFile);
|
||||||
|
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
|
||||||
|
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startList() {
|
||||||
|
ProfileAdapter adapter = new ProfileAdapter(getActivity(), downloadClass.getmList());
|
||||||
|
listView.setAdapter(adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grabs the image just taken by the built-in camera and pushes this image to the user account.
|
||||||
|
* @param requestCode The code which corresponds to REQUEST_TAKE_PHOTO. Used as indicator.
|
||||||
|
* @param resultCode Code should be RESULT_OK to allow camera to proceed.
|
||||||
|
* @param data The image data from the camera.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode == REQUEST_TAKE_PHOTO && resultCode == RESULT_OK) {
|
||||||
|
progressDialog = ProgressDialog.show(getActivity(), getString(R.string.please_wait), getString(R.string.upload_profile_pic), false, false);
|
||||||
|
ProfilePictureUploader profilePictureUploader = new ProfilePictureUploader(getActivity());
|
||||||
|
profilePictureUploader.uploadProfilePicture(photoFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private File createImageFile() throws IOException {
|
||||||
|
// Create an image file name
|
||||||
|
String imageFileName = "JPEG_" + user.getUid();
|
||||||
|
File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||||
|
return File.createTempFile(
|
||||||
|
imageFileName, /* prefix */
|
||||||
|
".jpg", /* suffix */
|
||||||
|
storageDir /* directory */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Make this function into its own class for modularity.
|
||||||
|
/**
|
||||||
|
* Performs password reset action.
|
||||||
|
*/
|
||||||
|
public void changePwdOnClick() {
|
||||||
|
if (user != null && user.getEmail() != null) {
|
||||||
|
FirebaseAuth.getInstance().sendPasswordResetEmail(user.getEmail())
|
||||||
|
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
Toast.makeText(getActivity(), task.isSuccessful()
|
||||||
|
? getString(R.string.mail_successful)
|
||||||
|
: getString(R.string.mail_failed),
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// TODO Add code here for when there is no currently active user.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.firebase.ui.storage.images.FirebaseImageLoader;
|
||||||
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.database.FirebaseDatabase;
|
||||||
|
import com.google.firebase.storage.FirebaseStorage;
|
||||||
|
import com.google.firebase.storage.StorageReference;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import nl.myhyvesbookplus.tagram.model.UriPost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by marijnjansen on 26/06/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TimeLineAdapter extends BaseAdapter implements AdapterView.OnItemClickListener {
|
||||||
|
private static final String TAG = "TimeLineAdapter";
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
private Context mContext;
|
||||||
|
private ArrayList<UriPost> mData;
|
||||||
|
private DatabaseReference mRef;
|
||||||
|
|
||||||
|
TimeLineAdapter(Context context, ArrayList<UriPost> data) {
|
||||||
|
mContext = context;
|
||||||
|
mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
mData = data;
|
||||||
|
mRef = FirebaseDatabase.getInstance().getReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return mData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return mData.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
|
View rowView = mInflater.inflate(R.layout.list_item_timeline, parent, false);
|
||||||
|
|
||||||
|
// TextView userName = (TextView) rowView.findViewById(R.id.username_timeline);
|
||||||
|
TextView comment = (TextView) rowView.findViewById(R.id.comment_timeline);
|
||||||
|
final TextView nietSlechts = (TextView) rowView.findViewById(R.id.niet_slecht_count);
|
||||||
|
TextView dateTime = (TextView) rowView.findViewById(R.id.timeline_date);
|
||||||
|
ImageView photo = (ImageView) rowView.findViewById(R.id.timeline_image);
|
||||||
|
final ImageButton nietSlechtButton = (ImageButton) rowView.findViewById(R.id.niet_slecht_button);
|
||||||
|
|
||||||
|
final UriPost post = (UriPost) getItem(position);
|
||||||
|
|
||||||
|
nietSlechts.setText(Integer.toString(post.getNietSlechts()));
|
||||||
|
comment.setText(post.getComment());
|
||||||
|
|
||||||
|
nietSlechtButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Log.d(TAG, "onClick: " + position);
|
||||||
|
mRef.child("posts").child(post.getDatabaseEntryName())
|
||||||
|
.child("nietSlechts").setValue(post.getNietSlechts() + 1)
|
||||||
|
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
nietSlechts.setText(Integer.toString(post.getNietSlechts() + 1));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dateTime.setText(post.getDate().toString());
|
||||||
|
|
||||||
|
StorageReference ref = FirebaseStorage.getInstance().getReferenceFromUrl(post.getUri());
|
||||||
|
Glide.with(mContext)
|
||||||
|
.using(new FirebaseImageLoader())
|
||||||
|
.load(ref)
|
||||||
|
.into(photo);
|
||||||
|
|
||||||
|
|
||||||
|
return rowView;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback method to be invoked when an item in this AdapterView has
|
||||||
|
* been clicked.
|
||||||
|
* <p>
|
||||||
|
* Implementers can call getItemAtPosition(position) if they need
|
||||||
|
* to access the data associated with the selected item.
|
||||||
|
*
|
||||||
|
* @param parent The AdapterView where the click happened.
|
||||||
|
* @param view The view within the AdapterView that was clicked (this
|
||||||
|
* will be a view provided by the adapter)
|
||||||
|
* @param position The position of the view in the adapter.
|
||||||
|
* @param id The row id of the item that was clicked.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
Log.d(TAG, "onItemClick: rowNumber! "+ position);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,108 +1,38 @@
|
|||||||
package nl.myhyvesbookplus.tagram;
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.os.Bundle;
|
||||||
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.ListView;
|
||||||
|
|
||||||
|
import nl.myhyvesbookplus.tagram.controller.DownloadClass;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple {@link Fragment} subclass.
|
|
||||||
* Activities that contain this fragment must implement the
|
|
||||||
* {@link TimelineFragment.OnFragmentInteractionListener} interface
|
|
||||||
* to handle interaction events.
|
|
||||||
* Use the {@link TimelineFragment#newInstance} factory method to
|
|
||||||
* create an instance of this fragment.
|
|
||||||
*/
|
|
||||||
public class TimelineFragment extends Fragment {
|
public class TimelineFragment extends Fragment {
|
||||||
// TODO: Rename parameter arguments, choose names that match
|
|
||||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
|
||||||
private static final String ARG_PARAM1 = "param1";
|
|
||||||
private static final String ARG_PARAM2 = "param2";
|
|
||||||
|
|
||||||
// TODO: Rename and change types of parameters
|
private ListView listView;
|
||||||
private String mParam1;
|
private DownloadClass downloadClass;
|
||||||
private String mParam2;
|
|
||||||
|
|
||||||
private OnFragmentInteractionListener mListener;
|
|
||||||
|
|
||||||
public TimelineFragment() {
|
public TimelineFragment() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this factory method to create a new instance of
|
|
||||||
* this fragment using the provided parameters.
|
|
||||||
*
|
|
||||||
* @param param1 Parameter 1.
|
|
||||||
* @param param2 Parameter 2.
|
|
||||||
* @return A new instance of fragment TimelineFragment.
|
|
||||||
*/
|
|
||||||
// TODO: Rename and change types and number of parameters
|
|
||||||
public static TimelineFragment newInstance(String param1, String param2) {
|
|
||||||
TimelineFragment fragment = new TimelineFragment();
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putString(ARG_PARAM1, param1);
|
|
||||||
args.putString(ARG_PARAM2, param2);
|
|
||||||
fragment.setArguments(args);
|
|
||||||
return fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
if (getArguments() != null) {
|
|
||||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
|
||||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@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
|
View view = inflater.inflate(R.layout.fragment_timeline, container, false);
|
||||||
return inflater.inflate(R.layout.fragment_timeline, container, false);
|
listView = (ListView) view.findViewById(R.id.list);
|
||||||
|
|
||||||
|
downloadClass = new DownloadClass(getActivity());
|
||||||
|
downloadClass.getPostsFromServer();
|
||||||
|
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Rename method, update argument and hook method into UI event
|
public void startList() {
|
||||||
public void onButtonPressed(Uri uri) {
|
TimeLineAdapter adapter = new TimeLineAdapter(getActivity(), downloadClass.getmList());
|
||||||
if (mListener != null) {
|
listView.setAdapter(adapter);
|
||||||
mListener.onFragmentInteraction(uri);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttach(Context context) {
|
|
||||||
super.onAttach(context);
|
|
||||||
if (context instanceof OnFragmentInteractionListener) {
|
|
||||||
mListener = (OnFragmentInteractionListener) context;
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException(context.toString()
|
|
||||||
+ " must implement OnFragmentInteractionListener");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDetach() {
|
|
||||||
super.onDetach();
|
|
||||||
mListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This interface must be implemented by activities that contain this
|
|
||||||
* fragment to allow an interaction in this fragment to be communicated
|
|
||||||
* to the activity and potentially other fragments contained in that
|
|
||||||
* activity.
|
|
||||||
* <p>
|
|
||||||
* See the Android Training lesson <a href=
|
|
||||||
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
|
||||||
* >Communicating with Other Fragments</a> for more information.
|
|
||||||
*/
|
|
||||||
public interface OnFragmentInteractionListener {
|
|
||||||
// TODO: Update argument type and name
|
|
||||||
void onFragmentInteraction(Uri uri);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.controller;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
|
import com.google.firebase.database.DataSnapshot;
|
||||||
|
import com.google.firebase.database.DatabaseError;
|
||||||
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.database.FirebaseDatabase;
|
||||||
|
import com.google.firebase.database.ValueEventListener;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import nl.myhyvesbookplus.tagram.model.UriPost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by marijnjansen on 23/06/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DownloadClass {
|
||||||
|
private static final String TAG = "DownloadClass";
|
||||||
|
private DatabaseReference mDataRef;
|
||||||
|
private ArrayList<UriPost> mList;
|
||||||
|
private PostDownloadListener mListener;
|
||||||
|
|
||||||
|
public DownloadClass(Context context) {
|
||||||
|
if (context instanceof DownloadClass.PostDownloadListener) {
|
||||||
|
mListener = (PostDownloadListener) context;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(context.toString()
|
||||||
|
+ " must implement PostDownloadListener");
|
||||||
|
}
|
||||||
|
mDataRef = FirebaseDatabase.getInstance().getReference();
|
||||||
|
mList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getPostsFromServer() {
|
||||||
|
mDataRef.child("posts").addListenerForSingleValueEvent(new ValueEventListener() {
|
||||||
|
@Override
|
||||||
|
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||||
|
|
||||||
|
for (DataSnapshot data : dataSnapshot.getChildren()) {
|
||||||
|
UriPost tempPost = data.getValue(UriPost.class);
|
||||||
|
tempPost.setDatabaseEntryName(data.getKey());
|
||||||
|
mList.add(tempPost);
|
||||||
|
}
|
||||||
|
Collections.reverse(mList);
|
||||||
|
mListener.PostDownloaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelled(DatabaseError databaseError) {
|
||||||
|
Log.d(TAG, "onCancelled: " + databaseError.getDetails() + databaseError.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<UriPost> getmList() {
|
||||||
|
return mList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<UriPost> getOwnPosts() {
|
||||||
|
String currentUid = FirebaseAuth.getInstance().getCurrentUser().getUid();
|
||||||
|
ArrayList<UriPost> posts = new ArrayList<UriPost>();
|
||||||
|
|
||||||
|
for (UriPost post : mList) {
|
||||||
|
if (post.getPoster().equals(currentUid)) {
|
||||||
|
posts.add(post);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return posts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface PostDownloadListener {
|
||||||
|
void PostDownloaded();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.controller;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
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.OnSuccessListener;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.storage.UploadTask;
|
||||||
|
|
||||||
|
import nl.myhyvesbookplus.tagram.model.BitmapPost;
|
||||||
|
import nl.myhyvesbookplus.tagram.model.UriPost;
|
||||||
|
|
||||||
|
import static java.lang.System.currentTimeMillis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by marijnjansen on 25/06/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PostUploader extends UploadClass {
|
||||||
|
|
||||||
|
final private static String TAG = "PostUploader";
|
||||||
|
|
||||||
|
private PostUploadListener mListener;
|
||||||
|
|
||||||
|
public PostUploader(Context context) {
|
||||||
|
super();
|
||||||
|
if (context instanceof PostUploadListener) {
|
||||||
|
mListener = (PostUploadListener) context;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(context.toString()
|
||||||
|
+ " must implement PostUploadListener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void uploadPicture(final BitmapPost post) {
|
||||||
|
final String name = currentTimeMillis() + "_" + getUserUid();
|
||||||
|
|
||||||
|
UploadTask uploadTask = mStorageRef.child("posts").child(name + ".jpg").putBytes(bitmapToBytes(post.getBitmap()));
|
||||||
|
uploadTask.addOnFailureListener(new OnFailureListener() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Exception e) {
|
||||||
|
Log.d(TAG, "onFailure: Upload Failed");
|
||||||
|
mListener.PostUploadComplete(false);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
|
||||||
|
// Handle successful uploads on complete
|
||||||
|
Log.d(TAG, "onSuccess: Upload Success!");
|
||||||
|
Uri downloadUrl = taskSnapshot.getMetadata().getDownloadUrl();
|
||||||
|
putPostInDatabase(post.getUriPost(downloadUrl), name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void putPostInDatabase(UriPost post, String name) {
|
||||||
|
DatabaseReference ref = mDataRef.child("posts").child(name);
|
||||||
|
ref.setValue(post)
|
||||||
|
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
if (task.isSuccessful()) {
|
||||||
|
Log.d(TAG, "onComplete: Added post to database");
|
||||||
|
mListener.PostUploadComplete(true);
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "onComplete: " + task.getException().getLocalizedMessage());
|
||||||
|
mListener.PostUploadComplete(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface PostUploadListener {
|
||||||
|
void PostUploadComplete(Boolean success);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.controller;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
|
import com.google.android.gms.tasks.OnFailureListener;
|
||||||
|
import com.google.android.gms.tasks.OnSuccessListener;
|
||||||
|
import com.google.android.gms.tasks.Task;
|
||||||
|
import com.google.firebase.auth.UserProfileChangeRequest;
|
||||||
|
import com.google.firebase.storage.FirebaseStorage;
|
||||||
|
import com.google.firebase.storage.StorageMetadata;
|
||||||
|
import com.google.firebase.storage.StorageReference;
|
||||||
|
import com.google.firebase.storage.UploadTask;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import static java.lang.System.currentTimeMillis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by marijnjansen on 25/06/2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ProfilePictureUploader extends UploadClass {
|
||||||
|
|
||||||
|
final static private String TAG = "PPUploader";
|
||||||
|
|
||||||
|
private Uri oldPicture;
|
||||||
|
private ProfilePictureUpdatedListener mListener;
|
||||||
|
|
||||||
|
public ProfilePictureUploader(Context context) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
if (context instanceof ProfilePictureUpdatedListener) {
|
||||||
|
mListener = (ProfilePictureUpdatedListener) context;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(context.toString()
|
||||||
|
+ " must implement ProfilePictureUpdatedListener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void uploadProfilePicture(File picture) {
|
||||||
|
oldPicture = mUser.getPhotoUrl();
|
||||||
|
StorageMetadata metadata = new StorageMetadata.Builder()
|
||||||
|
.setContentType("image/jpg")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
UploadTask photoUpload = mStorageRef.child("profile").child(getUserUid() + "_" + currentTimeMillis()).putFile(Uri.fromFile(picture), metadata);
|
||||||
|
photoUpload.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
|
||||||
|
Uri downloadUrl = taskSnapshot.getDownloadUrl();
|
||||||
|
updateProfilePictureInUser(downloadUrl);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.addOnFailureListener(new OnFailureListener() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Exception e) {
|
||||||
|
mListener.ProfilePictureUpdated(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateProfilePictureInUser(Uri url) {
|
||||||
|
UserProfileChangeRequest request = new UserProfileChangeRequest.Builder()
|
||||||
|
.setPhotoUri(url)
|
||||||
|
.build();
|
||||||
|
mUser.updateProfile(request)
|
||||||
|
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
Log.d(TAG, "onComplete: Updated profile picture");
|
||||||
|
mListener.ProfilePictureUpdated(true);
|
||||||
|
if (oldPicture != null) {
|
||||||
|
removeOldPicture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeOldPicture() {
|
||||||
|
StorageReference ref = FirebaseStorage.getInstance().getReferenceFromUrl(oldPicture.toString());
|
||||||
|
ref.delete()
|
||||||
|
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NonNull Task<Void> task) {
|
||||||
|
if (task.isSuccessful()) {
|
||||||
|
Log.v(TAG, "onComplete: Delete successful");
|
||||||
|
} else {
|
||||||
|
Log.v(TAG, "onComplete: " + task.getException().getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ProfilePictureUpdatedListener {
|
||||||
|
void ProfilePictureUpdated(Boolean success);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.controller;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
|
import com.google.firebase.auth.FirebaseUser;
|
||||||
|
import com.google.firebase.database.DatabaseReference;
|
||||||
|
import com.google.firebase.database.FirebaseDatabase;
|
||||||
|
import com.google.firebase.storage.FirebaseStorage;
|
||||||
|
import com.google.firebase.storage.StorageReference;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that does all the photo uploading things.
|
||||||
|
*/
|
||||||
|
public abstract class UploadClass {
|
||||||
|
|
||||||
|
private static final String TAG = "UploadClass";
|
||||||
|
StorageReference mStorageRef;
|
||||||
|
DatabaseReference mDataRef;
|
||||||
|
FirebaseUser mUser;
|
||||||
|
|
||||||
|
UploadClass() {
|
||||||
|
mStorageRef = FirebaseStorage.getInstance().getReference();
|
||||||
|
mDataRef = FirebaseDatabase.getInstance().getReference();
|
||||||
|
mUser = FirebaseAuth.getInstance().getCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Helpers ///
|
||||||
|
|
||||||
|
byte[] bitmapToBytes(Bitmap bitmap) {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
|
||||||
|
return baos.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
String getUserUid() {
|
||||||
|
if (mUser != null) {
|
||||||
|
return mUser.getUid();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.model;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BitmapPost is a Class for a Post with a Bitmap as an image.
|
||||||
|
*/
|
||||||
|
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,63 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.model;
|
||||||
|
|
||||||
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post is a Class for a Post with a Bitmap as an image.
|
||||||
|
*/
|
||||||
|
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,45 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram.model;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UriPost is a Class for a Post with a Uri as an image.
|
||||||
|
*/
|
||||||
|
public class UriPost extends Post {
|
||||||
|
private String uri;
|
||||||
|
private String databaseEntryName;
|
||||||
|
|
||||||
|
public UriPost() {
|
||||||
|
// Default constructor required for calls to DataSnapshot.getValue(UriPost.class)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UriPost(Uri uri, String comment, Date date, int nietSlechts, String poster) {
|
||||||
|
super(comment, date, nietSlechts, poster);
|
||||||
|
this.uri = uri.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UriPost(String uri, String comment) {
|
||||||
|
super(comment);
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setUri(String uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatabaseEntryName() {
|
||||||
|
return databaseEntryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDatabaseEntryName(String databaseEntryName) {
|
||||||
|
this.databaseEntryName = databaseEntryName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 98 KiB |
@@ -5,5 +5,5 @@
|
|||||||
android:viewportWidth="24.0">
|
android:viewportWidth="24.0">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FF000000"
|
android:fillColor="#FF000000"
|
||||||
android:pathData="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z" />
|
android:pathData="M3,5v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2L5,3c-1.11,0 -2,0.9 -2,2zM15,9c0,1.66 -1.34,3 -3,3s-3,-1.34 -3,-3 1.34,-3 3,-3 3,1.34 3,3zM6,17c0,-2 4,-3.1 6,-3.1s6,1.1 6,3.1v1L6,18v-1z" />
|
||||||
</vector>
|
</vector>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:strokeColor="#AAAAAA" android:strokeWidth="0.5"
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:fillAlpha="0.5"
|
||||||
|
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:strokeColor="#AAAAAA" android:strokeWidth="0.5"
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:fillAlpha="0.5"
|
||||||
|
android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z"/>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:strokeColor="#AAAAAA" android:strokeWidth="0.5"
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:fillAlpha="0.5"
|
||||||
|
android:pathData="M9.4,10.5l4.77,-8.26C13.47,2.09 12.75,2 12,2c-2.4,0 -4.6,0.85 -6.32,2.25l3.66,6.35 0.06,-0.1zM21.54,9c-0.92,-2.92 -3.15,-5.26 -6,-6.34L11.88,9h9.66zM21.8,10h-7.49l0.29,0.5 4.76,8.25C21,16.97 22,14.61 22,12c0,-0.69 -0.07,-1.35 -0.2,-2zM8.54,12l-3.9,-6.75C3.01,7.03 2,9.39 2,12c0,0.69 0.07,1.35 0.2,2h7.49l-1.15,-2zM2.46,15c0.92,2.92 3.15,5.26 6,6.34L12.12,15L2.46,15zM13.73,15l-3.9,6.76c0.7,0.15 1.42,0.24 2.17,0.24 2.4,0 4.6,-0.85 6.32,-2.25l-3.66,-6.35 -0.93,1.6z"/>
|
||||||
|
</vector>
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24.0"
|
|
||||||
android:viewportWidth="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z" />
|
|
||||||
</vector>
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:strokeColor="#AAAAAA" android:strokeWidth="0.5"
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:fillAlpha="0.5"
|
||||||
|
android:pathData="M20,4h-3.17L15,2L9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM15,15.5L15,13L9,13v2.5L5.5,12 9,8.5L9,11h6L15,8.5l3.5,3.5 -3.5,3.5z"/>
|
||||||
|
</vector>
|
||||||
|
Before Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 48 KiB |
@@ -1,24 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?><!--<android.support.constraint.ConstraintLayout 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"--><!--tools:context="nl.myhyvesbookplus.tagram.LoginActivity">-->
|
<?xml version="1.0" encoding="utf-8"?><!--<android.support.constraint.ConstraintLayout 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"--><!--tools:context="nl.myhyvesbookplus.tagram.LoginActivity">-->
|
||||||
|
|
||||||
<!--</android.support.constraint.ConstraintLayout>-->
|
<!--</android.support.constraint.ConstraintLayout>-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
tools:context=".LoginActivity">
|
tools:context=".LoginActivity">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
|
android:contentDescription="@string/logo_text"
|
||||||
android:cropToPadding="false"
|
android:cropToPadding="false"
|
||||||
android:padding="16dp"
|
android:paddingEnd="@dimen/activity_horizontal_margin"
|
||||||
android:src="@drawable/logo" />
|
android:paddingStart="@dimen/activity_horizontal_margin"
|
||||||
|
android:src="@drawable/logo_new" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -78,7 +89,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:onClick="logInOnClick"
|
|
||||||
android:text="@string/login_button" />
|
android:text="@string/login_button" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -87,7 +97,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:onClick="goToRegisterOnClick"
|
|
||||||
android:text="@string/register" />
|
android:text="@string/register" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -96,7 +105,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:onClick="registerOnClick"
|
|
||||||
android:text="@string/register"
|
android:text="@string/register"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
@@ -106,8 +114,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:onClick="backToLoginOnClick"
|
|
||||||
android:text="@string/back_to_login"
|
android:text="@string/back_to_login"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</FrameLayout>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:padding="16dp">
|
android:padding="0dp">
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<android.support.design.widget.BottomNavigationView
|
<android.support.design.widget.BottomNavigationView
|
||||||
|
|||||||
@@ -1,25 +1,141 @@
|
|||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="nl.myhyvesbookplus.tagram.CameraFragment">
|
tools:context="nl.myhyvesbookplus.tagram.CameraFragment">
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
|
android:id="@+id/camera_preview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/picture_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:padding="15dp"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:scaleX="2.5"
|
||||||
|
android:scaleY="2.5"
|
||||||
|
android:src="@drawable/ic_camera_black_24dp"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/switch_camera_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_margin="9dp"
|
||||||
|
android:scaleX="1.5"
|
||||||
|
android:scaleY="1.5"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:src="@drawable/ic_switch_camera_black_24dp"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/load_bar"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:indeterminate="true"
|
||||||
|
android:layout_centerInParent="true"/>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/filter_buttons"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_marginBottom="60dp"
|
||||||
|
android:layout_centerVertical="true">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/filter_left"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:scaleX="2"
|
||||||
|
android:scaleY="2"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:src="@drawable/ic_arrow_back_black_24dp"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/filter_right"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:scaleX="2"
|
||||||
|
android:scaleY="2"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:src="@drawable/ic_arrow_forward_black_24dp"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/comment_box"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:clickable="false"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:background="@android:color/background_light"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/hello_camera" />
|
android:text="@string/comment"/>
|
||||||
|
|
||||||
<Button
|
<EditText
|
||||||
|
android:id="@+id/comment_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:onClick="logOutOnClick"
|
android:lines="4"
|
||||||
android:text="LogOut" />
|
android:layout_margin="4dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:background="@android:color/darker_gray"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/comment_submit"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/upload"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/comment_cancel"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/cancel"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- TODO: Update blank fragment layout -->
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:id="@+id/upload_button"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:layout_margin="15dp"
|
||||||
|
app:fabSize="normal"
|
||||||
|
android:src="@android:drawable/ic_menu_upload"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context="nl.myhyvesbookplus.tagram.ProfileFragment">
|
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:text="@string/hello_blank_fragment" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="5dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/profile_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="Name:"
|
||||||
|
android:textSize="25sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="10dp" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/profile_pic_button"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginStart="110dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:elevation="1dp"
|
||||||
|
app:srcCompat="@android:drawable/ic_menu_camera" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView_profile_picture"
|
||||||
|
android:contentDescription="@string/profile_picture_description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="300dp"
|
||||||
|
app:srcCompat="@drawable/avatar_standard"
|
||||||
|
android:layout_marginTop="-70dp"/>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="25dp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/change_psw_button"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:text="@string/change_psw_button"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="20dp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/logout_button"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:onClick="logOutOnClick"
|
||||||
|
android:text="@string/logout_button"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="10dp" />
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="10dp" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context="nl.myhyvesbookplus.tagram.TimelineFragment">
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listview_profile"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -1,13 +1,23 @@
|
|||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
tools:context="nl.myhyvesbookplus.tagram.TimelineFragment">
|
tools:context="nl.myhyvesbookplus.tagram.TimelineFragment">
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
<TextView
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/swiperefresh"
|
||||||
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" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
<ListView
|
||||||
|
android:id="@+id/list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="15dp" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/username_timeline"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/timeline_image"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="250dp"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/comment_timeline"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:text="Hallo Ik ben een comment!" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/timeline_date"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="date/time" />
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp">
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/niet_slecht_button"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/niet_slecht" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/niet_slecht_count"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="10" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="10dp" />
|
||||||
|
</LinearLayout>
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="15dp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/timeline_image_profile"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_height="250dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/comment_timeline_profile"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="Hallo Ik ben een comment!" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="@string/niet_slecht"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/niet_slecht_count_profile"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="10" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="15dp" />
|
||||||
|
</LinearLayout>
|
||||||
@@ -8,12 +8,12 @@
|
|||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/navigation_camera"
|
android:id="@+id/navigation_camera"
|
||||||
android:icon="@drawable/ic_dashboard_black_24dp"
|
android:icon="@drawable/ic_photo_camera_black_24dp"
|
||||||
android:title="@string/title_dashboard" />
|
android:title="@string/title_dashboard" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/navigation_profile"
|
android:id="@+id/navigation_profile"
|
||||||
android:icon="@drawable/ic_notifications_black_24dp"
|
android:icon="@drawable/ic_account_box_black_24dp"
|
||||||
android:title="@string/title_notifications" />
|
android:title="@string/title_notifications" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 19 KiB |
@@ -12,4 +12,26 @@
|
|||||||
<string name="title_notifications">Profiel</string>
|
<string name="title_notifications">Profiel</string>
|
||||||
<string name="username">Gebruikersnaam</string>
|
<string name="username">Gebruikersnaam</string>
|
||||||
<string name="confirm_password_hint">bevestig wachtwoord</string>
|
<string name="confirm_password_hint">bevestig wachtwoord</string>
|
||||||
|
<string name="logo_text">MyHyvesBookPlusTagram logo</string>
|
||||||
|
<string name="logout_button">Uitloggen</string>
|
||||||
|
<string name="profile_picture_button">Wijzig Profiel Foto</string>
|
||||||
|
<string name="profile_picture_description">profiel foto</string>
|
||||||
|
<string name="change_psw_button">Wachtwoord wijzigen</string>
|
||||||
|
<string name="please_wait">Momentje</string>
|
||||||
|
<string name="hello_blank_fragment">Hallo leeg fragment</string>
|
||||||
|
<string name="hello_camera">Hallo Camera fragment</string>
|
||||||
|
<string name="login_error">Voer alstublieft email en wachtwoord in</string>
|
||||||
|
<string name="mail_failed">Er is een fout opgetreden. Controleer internetverbinding.</string>
|
||||||
|
<string name="mail_successful">Er is een e-mail verzonden. Volg a.u.b. de instructies.</string>
|
||||||
|
<string name="password_match_error">Wachtwoorden komen niet overeen</string>
|
||||||
|
<string name="register_error">Vul alstublieft alle velden in</string>
|
||||||
|
<string name="save">Opslaan</string>
|
||||||
|
<string name="upload">Uploaden</string>
|
||||||
|
<string name="image_save_error">Foto opslaan mislukt. Zorg a.u.b. dat er genoeg ruimte op uw telefoon beschikbaar is.</string>
|
||||||
|
<string name="update_profile_pic_error">Het updaten van de profielfoto is mislukt. Controleer uw internetverbinding.</string>
|
||||||
|
<string name="upload_profile_pic">Profielfoto aan het uploaden…</string>
|
||||||
|
<string name="niet_slecht">\"\"Niet slecht.\"s: \"</string>
|
||||||
|
<string name="mail_success">An e-mail was sent, please follow its instructions.</string>
|
||||||
|
<string name="comment">Bijschrift:</string>
|
||||||
|
<string name="cancel">Annuleer</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -2,5 +2,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#fbbf2d</color>
|
<color name="colorPrimary">#fbbf2d</color>
|
||||||
<color name="colorPrimaryDark">#ffa70f</color>
|
<color name="colorPrimaryDark">#ffa70f</color>
|
||||||
|
<!--<color name="colorAccent">#4bAfe5</color>-->
|
||||||
<color name="colorAccent">#4CAF50</color>
|
<color name="colorAccent">#4CAF50</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<item name="pic_preview" type="id"/>
|
||||||
|
<item name="camera_preview" type="id"/>
|
||||||
|
</resources>
|
||||||
@@ -3,8 +3,6 @@
|
|||||||
<string name="title_home">Timeline</string>
|
<string name="title_home">Timeline</string>
|
||||||
<string name="title_dashboard">Camera</string>
|
<string name="title_dashboard">Camera</string>
|
||||||
<string name="title_notifications">Profile</string>
|
<string name="title_notifications">Profile</string>
|
||||||
|
|
||||||
<!-- TODO: Remove or change this placeholder text -->
|
|
||||||
<string name="username">Username</string>
|
<string name="username">Username</string>
|
||||||
<string name="password">Password</string>
|
<string name="password">Password</string>
|
||||||
<string name="confirm_password">Confirm Password</string>
|
<string name="confirm_password">Confirm Password</string>
|
||||||
@@ -13,8 +11,25 @@
|
|||||||
<string name="register">Register</string>
|
<string name="register">Register</string>
|
||||||
<string name="back_to_login">back to Login</string>
|
<string name="back_to_login">back to Login</string>
|
||||||
<string name="email">Email</string>
|
<string name="email">Email</string>
|
||||||
|
<string name="login_error">Please fill in email and password</string>
|
||||||
<!-- TODO: Remove or change this placeholder text -->
|
<string name="password_match_error">Passwords do not match</string>
|
||||||
|
<string name="register_error">Please fill in all the fields</string>
|
||||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
<string name="hello_camera">Hello Camera</string>
|
<string name="hello_camera">Hello Camera</string>
|
||||||
|
<string name="logo_text">MyHyvesBookPlusTagram logo</string>
|
||||||
|
<string name="logout_button">Logout</string>
|
||||||
|
<string name="profile_picture_button">Change Profile Picture</string>
|
||||||
|
<string name="profile_picture_description">profile picture</string>
|
||||||
|
<string name="change_psw_button">Change Password</string>
|
||||||
|
<string name="please_wait">Please Wait</string>
|
||||||
|
<string name="niet_slecht">\"\"Niet slecht.\"s: \"</string>
|
||||||
|
<string name="upload">Upload</string>
|
||||||
|
<string name="save">Save</string>
|
||||||
|
<string name="mail_successful">An e-mail was sent. Please follow its instructions.</string>
|
||||||
|
<string name="mail_failed">An error occurred. Please check internet connection.</string>
|
||||||
|
<string name="image_save_error">Saving image to storage failed. Please make sure there is space available on the device.</string>
|
||||||
|
<string name="update_profile_pic_error">Updating the profile picture failed. Please check network connection.</string>
|
||||||
|
<string name="upload_profile_pic">Uploading profile picture…</string>
|
||||||
|
<string name="comment">Comment:</string>
|
||||||
|
<string name="cancel">Cancel</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<external-files-path name="profile_pic_URI" path="Pictures/" />
|
||||||
|
</paths>
|
||||||
|
</resources>
|
||||||
2
logboek/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
logboek.pdf
|
||||||
|
|
||||||
117
logboek/logboek.tex
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% LATEX-TEMPLATE GENERIEK
|
||||||
|
% Voor readme en meest recente versie, zie
|
||||||
|
% https://gitlab-fnwi.uva.nl/informatica/LaTeX-template.git
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
%-------------------------------------------------------------------------------
|
||||||
|
% PACKAGES EN DOCUMENT CONFIGURATIE
|
||||||
|
%-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
\documentclass{uva-inf-article}
|
||||||
|
\usepackage[dutch]{babel}
|
||||||
|
\usepackage{booktabs}
|
||||||
|
%-------------------------------------------------------------------------------
|
||||||
|
% GEGEVENS VOOR IN DE TITEL, HEADER EN FOOTER
|
||||||
|
%-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
% Vul de naam van de opdracht in.
|
||||||
|
\assignment{MyHyvesBookPlusTagram}
|
||||||
|
% Vul het soort opdracht in.
|
||||||
|
\assignmenttype{Samenvatting}
|
||||||
|
% Vul de titel van de eindopdracht in.
|
||||||
|
\title{Logboek}
|
||||||
|
|
||||||
|
% Vul de volledige namen van alle auteurs in.
|
||||||
|
\authors{Niels Zwemmer}
|
||||||
|
% Vul de corresponderende UvAnetID's in.
|
||||||
|
\uvanetids{11025980}
|
||||||
|
|
||||||
|
% Vul altijd de naam in van diegene die het nakijkt, tutor of docent.
|
||||||
|
\tutor{Youri Voet}
|
||||||
|
% Vul indien nodig de naam van de begeleider in.
|
||||||
|
\mentor{}
|
||||||
|
% Vul eventueel ook de naam van de docent of vakcoordinator toe.
|
||||||
|
\docent{}
|
||||||
|
% Vul hier de naam van de PAV-groep in.
|
||||||
|
\group{The Return Of MyHyvesBook+}
|
||||||
|
% Vul de naam van de cursus in.
|
||||||
|
\course{}
|
||||||
|
% Te vinden op onder andere Datanose.
|
||||||
|
\courseid{}
|
||||||
|
\date{\today}
|
||||||
|
|
||||||
|
% Dit is de datum die op het document komt te staan. Standaard is dat vandaag.
|
||||||
|
|
||||||
|
%-------------------------------------------------------------------------------
|
||||||
|
% VOORPAGINA EN EVENTUEEL INHOUDSOPGAVE EN ABSTRACT
|
||||||
|
%-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\maketitle
|
||||||
|
|
||||||
|
%-------------------------------------------------------------------------------
|
||||||
|
% INHOUD
|
||||||
|
%-------------------------------------------------------------------------------
|
||||||
|
\section{Algemeen}
|
||||||
|
\subsection{19-6-2017}
|
||||||
|
De dag verliep anders dan verwacht door een onverwachte opdracht die de TA's ons oplegde. Deze bestond uit een pitch van een paar minuten die ons plan en project
|
||||||
|
duidelijk moesten maken. Dit plan werd goedgekeurd door Youri. Voor de pitches stond de tijd van 13:00 tot 14:00 ingesteld. Door deze pitch is onze vergadering verplaatst naar dinsdag 20-6-2017 van 11:00 tot 12:00.
|
||||||
|
Na de pitch hebben wij nog geprogrammeerd tot ongeveer 15:00. Daarna zijn wij naar huis gegaan en heeft iedereen voor zichzelf gewerkt.
|
||||||
|
\subsection{20-6-2017}
|
||||||
|
Allereerst zijn de laatste oefenopgaven nagekeken. Daarna zijn Felix en Marijn direct begonnen aan hun onderdelen implementeren waarna Paul en Niels zich bij hen voegden. Marijn heeft het logo ge\"updatet en is begonnen met de upload-class implementeren. Felix heeft een eerste versie van de CameraView gemaakt.
|
||||||
|
Paul is begonnen aan de profielpagina en Niels heeft hem daarmee geholpen. Ook heeft Niels de notulen voor de vergadering gemaakt die vandaag van 11:00 tot 12:00 plaatsvond. Tijdens deze vergadering zijn vooral een aantal ontwerpkeuzes besproken. Tot slot is er een template gemaakt voor de logboeken van ieder persoon, zodat productiviteit zo veel mogelijk ongehinderd kan blijven door het achteraf moeten stroomlijnen van dit soort zaken.
|
||||||
|
\subsection{21-6-2017}
|
||||||
|
De dag begon om 11:00 met een bijeenkomst van Marijn, Niels en Paul. Felix kon niet aanwezig zijn vandaag maar heeft dat gecompenseerd door veel thuis gewerkt te hebben aan de opdracht. Paul en Niels hebben de profielpagina nagenoeg afgemaakt en wachten nu tot Marijn en Felix hun eerste deel hebben ge\"implementeerd zodat zij verder kunnen. Dit zijn de onderdelen foto uploaden en wachtwoord wijzigen.\\
|
||||||
|
Om 13:00 ging Marijn naar zijn Minor Programmeren groep om daar TA te zijn. Paul en Niels hebben tussen 13:00 en 15:00 gewerkt aan de interface opleuken van de profielpagina naast de functionaliteiten die eerder al waren verwerkt.
|
||||||
|
Om 15:00 ging iedereen naar huis, met uitzondering van Marijn die pas om 16:00 klaar was.
|
||||||
|
\subsection{22-6-2017}
|
||||||
|
Vandaag hebben wij om 10 uur afgesproken om alvast een eerste versie van onze poster te maken. We zijn over het algemeen al tevreden over dat resultaat maar de definitieve versie zal minder tekst en meer, grotere plaatjes moeten bevatten.
|
||||||
|
Nadat de poster klaar was, hebben wij geprogrammeerd tot 15:00; de tijd waarop de PAV bijeenkomst begon.
|
||||||
|
Marijn was vanaf 13:00 weer te vinden in het Minor Programmeren lokaal. We hebben allemaal wat progressie geboekt. Paul heeft Felix ondersteunt met zijn camera implementatie waardoor Felix nu bijna toe is aan de filterimplementatie.
|
||||||
|
Marijn is bezig geweest aan de poster ontwerpen onder het toeziend oog van Felix als hoofd-design en Niels heeft een eerste implementatie gedaan voor het updaten van de profielfoto. Na de PAV-bijeenkomst is iedereen in de stromende regen naar huis gegaan.
|
||||||
|
\subsection{23-6-2017}
|
||||||
|
De dag begon deze keer met een korte programmeersessie tussen Marijn en Niels. Felix was iets later aanwezig. Marijn heeft Niels geholpen met een aantal laatste functionaliteiten toevoegen voor het uploaden van een foto naar de Firebase storage. Felix heeft zich vooral bezig gehouden met het implementeren van de filters. Hij heeft zijn camera-deel waarbij zowel een upload -als opslagfunctie is ingebouwd nu.
|
||||||
|
Paul kon vandaag niet aanwezig zijn. Hij heeft zich echter van huis uit bezig gehouden met zijn gedeelte van de profielpagina en heeft een aantal wijzigingen met mij besproken. We hebben een vergadering gehouden van 11:30 tot ongeveer 12:30. Uit deze vergadering zijn een aantal dingen gebleken. Zo hebben wij bijvoorbeeld geconstateerd dat een bitmap niet de beste methode is om de profielfoto op te slaan, omdat deze een slechte kwaliteit biedt.
|
||||||
|
Marijn was vandaag niet nodig bij de Minor Programmeren. Hierdoor waren wij de gehele dag gezamelijk bezig aan de opdracht wat ervoor zorgde dat er een grote productiviteit was.
|
||||||
|
\subsection{24-6-2017 (Zaterdag) }
|
||||||
|
Een ieder is van huis uit bezig geweest met zijn eigen onderdelen t.b.v. Trello. Communicatieverkeer was er nauwelijks omdat iedereen nu goed gefocused kon zijn op zijn eigen werk.
|
||||||
|
\subsection{25-6-2017 (Zondag) }
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{26-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{27-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{28-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{29-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{30-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
|
||||||
|
\section{Persoonlijk}
|
||||||
|
\subsection{19-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{20-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{21-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{22-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{23-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{24-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{25-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{26-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{27-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{28-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{29-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\subsection{30-6-2017}
|
||||||
|
Lorem Ipsum Dolor sit amet.
|
||||||
|
\end{document}
|
||||||