mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 08:38:03 -06:00
Solve random things
This commit is contained in:
@@ -6,7 +6,7 @@ import android.graphics.Color;
|
||||
public class Colors {
|
||||
// Lists and stuff
|
||||
public static final int color_found = 0x7f00ff00;
|
||||
public static final int color_rescout = 0x7f0000ff;
|
||||
public static final int color_rescout = 0xff007fff;
|
||||
public static final int color_not_found = 0x7f7f0000;
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ public class Colors {
|
||||
public static final int unfocused_background_color = 0x50118811;
|
||||
|
||||
|
||||
public static final int unsaved_color = 0x60ff0000;
|
||||
public static final int saved_color = 0x6000ff00;
|
||||
public static final int rescout_color = 0x600000ff;
|
||||
public static final int unsaved_color = 0xffaa0000;
|
||||
public static final int saved_color = 0xff00aa00;
|
||||
public static final int rescout_color = 0xff007fff;
|
||||
|
||||
|
||||
// Data graphs
|
||||
|
||||
@@ -25,11 +25,24 @@ public class ImageRequestTask extends AsyncTask<String, Void, Bitmap> {
|
||||
try {
|
||||
URL url = new URL(src);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
// We do a little bit of spoofing
|
||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
|
||||
connection.setDoInput(true);
|
||||
connection.connect();
|
||||
InputStream input = connection.getInputStream();
|
||||
return BitmapFactory.decodeStream(input);
|
||||
} catch (FileNotFoundException e) {
|
||||
|
||||
int code = connection.getResponseCode();
|
||||
switch (code) {
|
||||
case 200:
|
||||
InputStream input = connection.getInputStream();
|
||||
return BitmapFactory.decodeStream(input);
|
||||
case 403:
|
||||
// AlertManager.error("Got 403, Going to https://www.thebluealliance.com/avatars may fix this");
|
||||
return null;
|
||||
default:
|
||||
AlertManager.error("Error downloading image " + src, "Got response code: " + code);
|
||||
return null;
|
||||
}
|
||||
} catch (FileNotFoundException e){
|
||||
return null;
|
||||
} catch (IOException e){
|
||||
AlertManager.error("Error downloading image " + src, e);
|
||||
|
||||
Reference in New Issue
Block a user