Niels profile #21
@@ -6,7 +6,7 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "nl.myhyvesbookplus.tagram"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 25
|
||||
targetSdkVersion 21
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package nl.myhyvesbookplus.tagram;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
@@ -15,7 +16,6 @@ import android.view.View;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
|
||||
import nl.myhyvesbookplus.tagram.controller.DownloadClass;
|
||||
import nl.myhyvesbookplus.tagram.controller.PostUploader;
|
||||
import nl.myhyvesbookplus.tagram.controller.ProfilePictureUploader;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements
|
||||
@@ -104,11 +104,6 @@ public class MainActivity extends AppCompatActivity implements
|
||||
this.finish();
|
||||
}
|
||||
|
||||
// public void testCreatePost(View view) {
|
||||
// DownloadClass downloadClass = new DownloadClass();
|
||||
// downloadClass.getPosts();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void ProfilePictureUpdated(Boolean success) {
|
||||
Log.d(TAG, "ProfilePictureUpdated: Ja ik luister naar je!");
|
||||
@@ -125,9 +120,10 @@ public class MainActivity extends AppCompatActivity implements
|
||||
@Override
|
||||
public void PostDownloaded() {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
fragmentManager.findFragmentById(R.id.content);
|
||||
TimelineFragment frag = (TimelineFragment) fragmentManager.findFragmentById(R.id.content);
|
||||
frag.startList();
|
||||
Fragment frag = fragmentManager.findFragmentById(R.id.content);
|
||||
|
||||
if (frag instanceof TimelineFragment) {
|
||||
((TimelineFragment) frag).startList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ 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;
|
||||
|
||||
@@ -22,7 +24,7 @@ import nl.myhyvesbookplus.tagram.model.UriPost;
|
||||
* Created by marijnjansen on 26/06/2017.
|
||||
*/
|
||||
|
||||
public class TimeLineAdapter extends BaseAdapter {
|
||||
public class TimeLineAdapter extends BaseAdapter implements AdapterView.OnItemClickListener {
|
||||
private static final String TAG = "TimeLineAdapter";
|
||||
private LayoutInflater mInflater;
|
||||
private Context mContext;
|
||||
@@ -55,12 +57,20 @@ public class TimeLineAdapter extends BaseAdapter {
|
||||
View rowView = mInflater.inflate(R.layout.list_item_timeline, parent, false);
|
||||
|
||||
TextView comment = (TextView) rowView.findViewById(R.id.comment_timeline);
|
||||
TextView nietslechts = (TextView) rowView.findViewById(R.id.niet_slecht_count);
|
||||
TextView nietSlechts = (TextView) rowView.findViewById(R.id.niet_slecht_count);
|
||||
ImageView photo = (ImageView) rowView.findViewById(R.id.timeline_image);
|
||||
ImageButton nietSlechtButton = (ImageButton) rowView.findViewById(R.id.niet_slecht_button);
|
||||
|
||||
nietSlechtButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
UriPost post = (UriPost) getItem(position);
|
||||
|
||||
nietslechts.setText(Integer.toString(post.getNietSlechts()));
|
||||
nietSlechts.setText(Integer.toString(post.getNietSlechts()));
|
||||
comment.setText(post.getComment());
|
||||
|
||||
StorageReference ref = FirebaseStorage.getInstance().getReferenceFromUrl(post.getUri());
|
||||
@@ -72,4 +82,24 @@ public class TimeLineAdapter extends BaseAdapter {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,13 +10,7 @@ import android.widget.ListView;
|
||||
import nl.myhyvesbookplus.tagram.controller.DownloadClass;
|
||||
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link TimelineFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class TimelineFragment extends Fragment {
|
||||
final private static String TAG = "TimelineFragment";
|
||||
|
||||
private ListView listView;
|
||||
private DownloadClass downloadClass;
|
||||
@@ -25,29 +19,15 @@ public class TimelineFragment extends Fragment {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
* @return A new instance of fragment TimelineFragment.
|
||||
*/
|
||||
// TODO: Rename and change types and number of parameters
|
||||
public static TimelineFragment newInstance() {
|
||||
TimelineFragment fragment = new TimelineFragment();
|
||||
Bundle args = new Bundle();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_timeline, container, false);
|
||||
|
||||
listView = (ListView) view.findViewById(R.id.listview);
|
||||
|
||||
downloadClass = new DownloadClass(getActivity());
|
||||
downloadClass.getPostsFromServer();
|
||||
|
||||
// Inflate the layout for this fragment
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
@@ -20,6 +21,7 @@
|
||||
android:layout_height="40dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/niet_slecht_button"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
@@ -30,6 +30,5 @@
|
||||
<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="please_wait">Wacht a.u.b.</string>
|
||||
<string name="niet_slecht">\"Niet slecht.\"s</string>
|
||||
</resources>
|
||||
@@ -2,6 +2,6 @@
|
||||
<resources>
|
||||
<color name="colorPrimary">#fbbf2d</color>
|
||||
<color name="colorPrimaryDark">#ffa70f</color>
|
||||
<color name="colorAccent">#4bAfe5</color>
|
||||
<!--<color name="colorAccent">#4CAF50</color>-->
|
||||
<!--<color name="colorAccent">#4bAfe5</color>-->
|
||||
<color name="colorAccent">#4CAF50</color>
|
||||
</resources>
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
<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="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="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>
|
||||
|
||||
Reference in New Issue
Block a user