Commit 9d42f9ba by german callejas

StudentFragmentGrid recuperado, imagenes de alumnos en lista arreglado

parent b9631968
...@@ -16,6 +16,7 @@ import java.io.FileNotFoundException; ...@@ -16,6 +16,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.regex.Pattern;
/** /**
* Img * Img
...@@ -42,7 +43,7 @@ public class Img { ...@@ -42,7 +43,7 @@ public class Img {
protected int id; protected int id;
protected String url; protected String url;
String type; String type;
final static String FILETYPE="png"; protected String FILETYPE="png";
Bitmap bitmap; Bitmap bitmap;
/** /**
...@@ -56,12 +57,21 @@ public class Img { ...@@ -56,12 +57,21 @@ public class Img {
this.url = url; this.url = url;
this.type=type; this.type=type;
this.bitmap=null; this.bitmap=null;
if(url != null){
String [] parts = url.split(Pattern.quote("."));
this.FILETYPE = parts[parts.length-1];
}
} }
public Img(Img i) { public Img(Img i) {
this.id = i.id; this.id = i.id;
this.url = new String(i.url); this.url = new String(i.url);
this.type=new String(i.type); this.type=new String(i.type);
if(url != null){
String [] parts = url.split(Pattern.quote("."));
this.FILETYPE = parts[parts.length-1];
}
try { try {
if (PCBcontext.getContext()!=null && i.get_bitmap(PCBcontext.getContext())!=null) if (PCBcontext.getContext()!=null && i.get_bitmap(PCBcontext.getContext())!=null)
this.bitmap=i.get_bitmap(PCBcontext.getContext()).copy(i.get_bitmap(PCBcontext.getContext()).getConfig(),true); this.bitmap=i.get_bitmap(PCBcontext.getContext()).copy(i.get_bitmap(PCBcontext.getContext()).getConfig(),true);
...@@ -69,13 +79,13 @@ public class Img { ...@@ -69,13 +79,13 @@ public class Img {
Log.e(this.getClass().getCanonicalName(),e.getMessage()); Log.e(this.getClass().getCanonicalName(),e.getMessage());
} }
} }
public String file_name() { return this.id+"."+Img.FILETYPE; } public String file_name() { return this.id+"."+this.FILETYPE; }
public int get_id() { return this.id;} public int get_id() { return this.id;}
public String get_url() { return this.url;} public String get_url() { return this.url;}
public void set_url(String url) {this.url=url;} public void set_url(String url) {this.url=url;}
public String get_type() { return this.type;} public String get_type() { return this.type;}
public String get_filetype() { return Img.FILETYPE;} public String get_filetype() { return this.FILETYPE;}
public void update_id(int id) { public void update_id(int id) {
this.id = id; this.id = id;
......
...@@ -4,6 +4,7 @@ import android.app.Activity; ...@@ -4,6 +4,7 @@ import android.app.Activity;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
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;
......
...@@ -72,6 +72,7 @@ public class LoginActivity extends FragmentActivity { ...@@ -72,6 +72,7 @@ public class LoginActivity extends FragmentActivity {
this.getIntent().getStringExtra("surname") + " (" + this.getIntent().getStringExtra("email") + ")"); this.getIntent().getStringExtra("surname") + " (" + this.getIntent().getStringExtra("email") + ")");
final Vector<Img> imgs = new Vector<>(1); final Vector<Img> imgs = new Vector<>(1);
Log.e("DETAIL","IMG SUP: "+this.getIntent().getStringExtra("pic"));
imgs.add(new Img( imgs.add(new Img(
this.getIntent().getIntExtra("sup_id", -1), this.getIntent().getIntExtra("sup_id", -1),
this.getIntent().getStringExtra("pic"), this.getIntent().getStringExtra("pic"),
...@@ -82,7 +83,7 @@ public class LoginActivity extends FragmentActivity { ...@@ -82,7 +83,7 @@ public class LoginActivity extends FragmentActivity {
public void loadComplete() { public void loadComplete() {
try { try {
supervisorPhotoView.setImageBitmap( supervisorPhotoView.setImageBitmap(
imgs.get(0).get_bitmap(PCBcontext.getContext()) imgs.get(0).get_bitmap(getApplicationContext())
); );
supervisorPhotoView.invalidate(); supervisorPhotoView.invalidate();
} catch (IOException e) { } catch (IOException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment