Merge remote-tracking branch 'origin/niels-profile' into paul-zoom

This commit is contained in:
Paul Lagerweij
2017-06-29 20:30:19 +02:00
5 changed files with 31 additions and 18 deletions

View File

@@ -246,15 +246,9 @@ public class CameraFragment extends Fragment implements PostUploader.PostUploadL
* Switch between front facing camera and the back camera. * Switch between front facing camera and the back camera.
*/ */
public void switchFacing() { public void switchFacing() {
if (facing == Camera.CameraInfo.CAMERA_FACING_FRONT) facing = facing == Camera.CameraInfo.CAMERA_FACING_FRONT ?
facing = Camera.CameraInfo.CAMERA_FACING_BACK; Camera.CameraInfo.CAMERA_FACING_BACK :
else Camera.CameraInfo.CAMERA_FACING_FRONT;
facing = Camera.CameraInfo.CAMERA_FACING_FRONT;
// TODO
// facing =
// facing == Camera.CameraInfo.CAMERA_FACING_FRONT ?
// Camera.CameraInfo.CAMERA_FACING_BACK :
// Camera.CameraInfo.CAMERA_FACING_FRONT;
} }
/** /**

View File

@@ -8,10 +8,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
@@ -28,12 +25,10 @@ import java.util.ArrayList;
import nl.myhyvesbookplus.tagram.model.UriPost; import nl.myhyvesbookplus.tagram.model.UriPost;
/** /**
* Created by niels on 27-6-17. * Class which creates views for the profile-page timeline. This is done with a ListView.
*/ */
public class ProfileAdapter extends BaseAdapter { public class ProfileAdapter extends BaseAdapter {
private static final String TAG = "ProfileAdapter";
private LayoutInflater mInflater; private LayoutInflater mInflater;
private Context mContext; private Context mContext;
private ArrayList<UriPost> mData; private ArrayList<UriPost> mData;
@@ -42,6 +37,7 @@ public class ProfileAdapter extends BaseAdapter {
private ImageView photo; private ImageView photo;
private Animator mCurrentAnimator; private Animator mCurrentAnimator;
/* ProfileAdapter constructor */
ProfileAdapter(Context context, ArrayList<UriPost> data) { ProfileAdapter(Context context, ArrayList<UriPost> data) {
mContext = context; mContext = context;
mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -63,6 +59,13 @@ public class ProfileAdapter extends BaseAdapter {
return position; return position;
} }
/**
* Initiate a new view to be part of the ListView.
* @param position The position at which the view should start.
* @param convertView The viewconverter.
* @param parent The parent of the view.
* @return
*/
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View rowView = mInflater.inflate(R.layout.list_item_timeline_profile, parent, false); View rowView = mInflater.inflate(R.layout.list_item_timeline_profile, parent, false);
@@ -85,6 +88,11 @@ public class ProfileAdapter extends BaseAdapter {
return newRowView; return newRowView;
} }
/**
* Find all views from within the row.
* @param rowView The row from which views must be found.
* @return The rowView which contains the necessary views.
*/
private View findViews(View rowView) { private View findViews(View rowView) {
comment = (TextView) rowView.findViewById(R.id.comment_timeline_profile); comment = (TextView) rowView.findViewById(R.id.comment_timeline_profile);
nietSlechts = (TextView) rowView.findViewById(R.id.niet_slecht_count_profile); nietSlechts = (TextView) rowView.findViewById(R.id.niet_slecht_count_profile);

View File

@@ -36,6 +36,11 @@ import nl.myhyvesbookplus.tagram.controller.ProfilePictureUploader;
import static android.app.Activity.RESULT_OK; import static android.app.Activity.RESULT_OK;
/**
* Profilefragment which holds the personal info of the user.
* Makes use of ProfileAdapter in order to load in the items for ListView.
*/
public class ProfileFragment extends Fragment implements View.OnClickListener { public class ProfileFragment extends Fragment implements View.OnClickListener {
static final int REQUEST_TAKE_PHOTO = 1; static final int REQUEST_TAKE_PHOTO = 1;
ProgressDialog progressDialog; ProgressDialog progressDialog;

View File

@@ -33,7 +33,7 @@ import java.util.ArrayList;
import nl.myhyvesbookplus.tagram.model.UriPost; import nl.myhyvesbookplus.tagram.model.UriPost;
/** /**
* Created by marijnjansen on 26/06/2017. * Class which creates views for the home-page timeline. This is done with a ListView.
*/ */
public class TimeLineAdapter extends BaseAdapter implements AdapterView.OnItemClickListener { public class TimeLineAdapter extends BaseAdapter implements AdapterView.OnItemClickListener {
@@ -44,6 +44,7 @@ public class TimeLineAdapter extends BaseAdapter implements AdapterView.OnItemCl
private DatabaseReference mRef; private DatabaseReference mRef;
private Animator mCurrentAnimator; private Animator mCurrentAnimator;
/* TimeLineAdapter constructor */
TimeLineAdapter(Context context, ArrayList<UriPost> data) { TimeLineAdapter(Context context, ArrayList<UriPost> data) {
mContext = context; mContext = context;
mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -66,11 +67,17 @@ public class TimeLineAdapter extends BaseAdapter implements AdapterView.OnItemCl
return position; return position;
} }
/**
* Initiate a new view to be part of the ListView.
* @param position The position at which the view should start.
* @param convertView The viewconverter.
* @param parent The parent of the view.
* @return
*/
@Override @Override
public View getView(final int position, View convertView, ViewGroup parent) { public View getView(final int position, View convertView, ViewGroup parent) {
View rowView = mInflater.inflate(R.layout.list_item_timeline, parent, false); 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); TextView comment = (TextView) rowView.findViewById(R.id.comment_timeline);
final TextView nietSlechts = (TextView) rowView.findViewById(R.id.niet_slecht_count); final TextView nietSlechts = (TextView) rowView.findViewById(R.id.niet_slecht_count);
TextView dateTime = (TextView) rowView.findViewById(R.id.timeline_date); TextView dateTime = (TextView) rowView.findViewById(R.id.timeline_date);

View File

@@ -1,7 +1,6 @@
package nl.myhyvesbookplus.tagram; package nl.myhyvesbookplus.tagram;
import android.app.Fragment; import android.app.Fragment;
import android.app.ProgressDialog;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;