Commit 874599b8 authored by Roger Barton's avatar Roger Barton
Browse files

Images and register request now working

parent 9ca34237
......@@ -24,7 +24,8 @@ dependencies {
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.mcxiaoke.volley:library:1.0.19'
//implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation project(path: ':volley')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
......
......@@ -108,12 +108,11 @@ public class EventDetailActivity extends AppCompatActivity {
Log.e("request", "image url: " + posterUrl.toString());
//posterImage.setImageUrl(posterUrl.toString(), Requests.GetImageLoader(getApplicationContext()));
ImageRequest posterRequest = new ImageRequest(posterUrl.toString(),
new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap bitmap) {
public void onResponse(final Bitmap bitmap) {
Log.e("request", "bitmap: " + bitmap.getHeight() +"\n" + bitmap.toString());
posterImage.setImageBitmap(bitmap);
//Will adjust the empty space/mask at the top of the scrollview so we can see the whole image
posterImage.post(new Runnable() {
......@@ -138,6 +137,9 @@ public class EventDetailActivity extends AppCompatActivity {
private void AddRegisterDetails ()
{
LinearLayout linear = findViewById(R.id.register_details_list);
linear.removeAllViews();
ArrayList<String[]> infos = Events.eventInfos.get(eventIndex).GetInfos();
LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
for (int i = 0; i < infos.size(); i++) {
......@@ -145,7 +147,6 @@ public class EventDetailActivity extends AppCompatActivity {
((TextView) layout.findViewById(R.id.keyField )).setText(infos.get(i)[0]);
((TextView) layout.findViewById(R.id.valueField)).setText(infos.get(i)[1]);
LinearLayout linear = findViewById(R.id.register_details_list);
linear.addView(layout);
}
}
......@@ -218,19 +219,6 @@ public class EventDetailActivity extends AppCompatActivity {
params.put("user", UserInfo.current._id);//XXX check user exists
return params;
}
/*
@Override
public byte[] getBody() throws AuthFailureError {
String body = "event:" + Events.eventInfos.get(eventIndex)._id + "\nuser:" + UserInfo.current._id;
byte[] bytes = new byte[0];
try {
bytes = body.getBytes("UTF-8");
Log.e("request", "body: " + new String(bytes, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return bytes;
}*/
};
Requests.SendRequest(request, getApplicationContext());
......
......@@ -2,6 +2,7 @@ package ch.amiv.android_app;
import android.media.Image;
import android.net.ParseException;
import android.util.Size;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;
......@@ -45,6 +46,9 @@ public class EventInfo {
* @return
*/
public ArrayList<String[]> GetInfos(){
if(infos != null && infos.size() > 0)
return infos;
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy HH:mm");
infos.add(new String[]{"Register Start", dateFormat.format(time_register_start)});
infos.add(new String[]{"Register End", dateFormat.format(time_register_end)});
......
......@@ -26,13 +26,14 @@
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent" />
<com.android.volley.toolbox.NetworkImageView
<ImageView
android:id="@+id/eventPoster"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
app:layout_constraintBottom_toTopOf="@+id/scrollView_event" />
app:layout_constraintTop_toBottomOf="@id/toolbar_include"
app:srcCompat="@mipmap/amiv_logo" />
<ScrollView
android:id="@+id/scrollView_event"
......@@ -48,8 +49,9 @@
<View
android:id="@+id/posterMask"
android:layout_width="match_parent"
android:layout_width="10dp"
android:layout_height="0dp"
android:alpha="0"
android:clickable="true"
android:onClick="ScrollToTop" />
......
include ':app'
include ':app', ':volley'
Subproject commit 0c32d6a8865ebe0daf320d2bd7e32368e0cc31ba
Subproject commit c9a77eb075ab04ec5aef2986620d31a1acbc0c95
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment