Skip to content

Commit

Permalink
fixed downloading of scaled content
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnPalmer committed Oct 13, 2014
1 parent 98e755a commit 46c5919
Show file tree
Hide file tree
Showing 15 changed files with 745 additions and 523 deletions.
4 changes: 2 additions & 2 deletions SUDEAU/src/net/movelab/sudeau/ChooseItineraryActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected void onCreate(Bundle savedInstanceState) {

if(!PropertyHolder.isInit())
PropertyHolder.init(context);

currentLocale = PropertyHolder.getLocale();
mPreferences = getSharedPreferences("EruletPreferences", MODE_PRIVATE);

// TODO just for testing
Expand Down Expand Up @@ -423,7 +423,7 @@ private MapBoxOfflineTileProvider initTileProvider(Context context) {
Util.baseFolder + "/" + Util.routeMapsFolder);

// TODO fix this temporary hack
File f = new File(sdcard, );
File f = new File(PropertyHolder.getGeneralMapPath());
Log.e("CARTO CHOOSE", f.getPath());

//File f = new File(getCacheDir() + "/Vista_general_vielha.mbtiles");
Expand Down
10 changes: 7 additions & 3 deletions SUDEAU/src/net/movelab/sudeau/DetailHighLightActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.json.JSONException;
import org.json.JSONObject;

import net.movelab.sudeau.database.DataBaseHelper;
import net.movelab.sudeau.database.DataContainer;
import net.movelab.sudeau.model.HighLight;
import net.movelab.sudeau.model.InteractiveImage;
Expand Down Expand Up @@ -130,9 +131,12 @@ public void onRatingChanged(RatingBar ratingBar, float rating,

ImageView ivPicture = (ImageView)findViewById(R.id.highLightPicture);
VideoView ivVideo = (VideoView)findViewById(R.id.highLightVideo);
if(hl!=null && hl.getMediaPath()!=null && !hl.getMediaPath().trim().equalsIgnoreCase("")){
String pathName = hl.getMediaPath().replace("file://", "");
if(pathName.contains("mp4")){
DataContainer.refreshHighlightForFileManifest(hl, app.getDataBaseHelper());
Log.i("MEDIAPATH: HAS FILE", "yes? " + hl.hasMediaFile());
if(hl!=null && hl.hasMediaFile()){
String pathName = hl.getFileManifest().getPath();
Log.i("MEDIAPATH: ", pathName);
if(pathName.contains("mp4")){
progressBar.setVisibility(View.GONE);
ivPicture.setVisibility(View.GONE);
ivVideo.setVideoURI(Uri.parse(pathName));
Expand Down
23 changes: 14 additions & 9 deletions SUDEAU/src/net/movelab/sudeau/DetailItineraryActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.json.JSONObject;

import net.movelab.sudeau.database.DataContainer;
import net.movelab.sudeau.model.FileManifest;
import net.movelab.sudeau.model.HighLight;
import net.movelab.sudeau.model.JSONConverter;
import net.movelab.sudeau.model.Reference;
Expand Down Expand Up @@ -338,6 +339,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
hl.setName(hlName);
hl.setLongText(hlLongText);
hl.setMediaPath(imagePath);
FileManifest new_file_manifest = new FileManifest();
new_file_manifest.setPath(imagePath);
hl.setFileManifest(new_file_manifest);
hl.setType(hlType);
Step s = fixReceiver.getStepById(stepBeingEditedId);
hl.setRadius(s.getPrecision());
Expand Down Expand Up @@ -1018,10 +1022,9 @@ public View getInfoContents(Marker marker) {
snippet.setText(h1.getLongText());
ImageView picture = (ImageView) myContentView
.findViewById(R.id.info_pic);
if (h1.getMediaPath() != null
&& !h1.getMediaPath().trim()
.equalsIgnoreCase("")) {
String file = h1.getMediaPath();
DataContainer.refreshHighlightForFileManifest(h1, app.getDataBaseHelper());
if (h1.hasMediaFile()) {
String file = h1.getFileManifest().getPath();
if (file.contains("mp4")) {
file = file.replace("file://", "");
Bitmap bm = ThumbnailUtils
Expand Down Expand Up @@ -1057,10 +1060,9 @@ public View getInfoContents(Marker marker) {
snippet.setText(h1.getLongText());
ImageView picture = (ImageView) myContentView
.findViewById(R.id.info_pic);
if (h1.getMediaPath() != null
&& !h1.getMediaPath().trim()
.equalsIgnoreCase("")) {
String file = h1.getMediaPath();
DataContainer.refreshHighlightForFileManifest(h1, app.getDataBaseHelper());
if (h1.hasMediaFile()) {
String file = h1.getFileManifest().getPath();
if (file.contains("mp4")) {
file = file.replace("file://", "");
Bitmap bm = ThumbnailUtils
Expand Down Expand Up @@ -1167,7 +1169,10 @@ private void launchHighLightEditIntent(Step s, HighLight h) {
i.putExtra("hlid", h.getId());
i.putExtra("hlname", h.getName());
i.putExtra("hllongtext", h.getLongText());
i.putExtra("hlimagepath", h.getMediaPath());
DataContainer.refreshHighlightForFileManifest(h, app.getDataBaseHelper());
if(h.hasMediaFile()){
i.putExtra("hlimagepath", h.getFileManifest().getPath());
}
}
startActivityForResult(i, HIGHLIGHT_EDIT_REQUEST);
}
Expand Down
4 changes: 2 additions & 2 deletions SUDEAU/src/net/movelab/sudeau/HTMLViewerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private String getReferenceString(){
String idReference = extras.getString("idReference");
Log.d("Reference ID: ", idReference);
Reference r = DataContainer.findReferenceById(idReference, app.getDataBaseHelper());
if(r != null && r.getTextContent() != null && r.getTextContent() != ""){
if(r != null && r.getTextContent() != null && !r.getTextContent().isEmpty()){
Log.d("Reference URL: ", "file://" + r.getTextContent());

String[] url_chop = r.getTextContent().split("/");
Expand Down Expand Up @@ -105,7 +105,7 @@ private String getReferenceString(){
}

// String modified_html_text = html_text.toString().replace("../", "" );
String modified_html_text = html_text.toString().replace("../", "file://" + Environment.getExternalStorageDirectory().getPath() + "/" + Util.baseFolder + "/" ).replace("</head>","</head><body>").replace("</html>", "</body></html>");
String modified_html_text = html_text.toString().replace("../", "file://" + Environment.getExternalStorageDirectory().getPath() + "/" + Util.baseFolder + "/" ).replace("</head>","</head><body>").replace("</html>", "</body></html>").replace("holet-ref-style.css", "erholet-ref-style.css");



Expand Down
25 changes: 24 additions & 1 deletion SUDEAU/src/net/movelab/sudeau/PropertyHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public class PropertyHolder {
public static final String LAST_UPDATE_GENERAL_MAP = "LAST_UPDATE_GENERAL_MAP";
public static final String LAST_UPDATE_GENERAL_REFERENCES = "LAST_UPDATE_GENERAL_REFERENCES";
public static final String LOCALE = "pref_locale";
public static final String GENERAL_MAP_PATH = "GENERAL_MAP_PATH";
public static final String GENERAL_REFERENCE_PATH = "GENERAL_REFERENCE_PATH";


public static final String ARANESE = "oc";
public static final String SPANISH = "es";
public static final String CATALAN = "ca";
Expand Down Expand Up @@ -99,6 +103,25 @@ public static void setUserId(String _userId) {
}


public static String getGeneralMapPath() {
return sharedPreferences.getString(GENERAL_MAP_PATH, null);
}

public static void setGeneralMapPath(String _path) {
editor.putString(GENERAL_MAP_PATH, _path);
editor.apply();
}

public static String getGeneralReferencePath() {
return sharedPreferences.getString(GENERAL_REFERENCE_PATH, null);
}

public static void setGeneralReferencePath(String _path) {
editor.putString(GENERAL_REFERENCE_PATH, _path);
editor.apply();
}


public static long getLastUpdateGeneralMap(){
return sharedPreferences.getLong(LAST_UPDATE_GENERAL_MAP, 0L);
}
Expand Down Expand Up @@ -132,7 +155,7 @@ public static void setLastUpdateGeneralReferencesNow(){


public static String getLocale() {
return sharedPreferences.getString(LOCALE, "");
return sharedPreferences.getString(LOCALE, "oc");
}

public static void setLocale(String _locale) {
Expand Down
Loading

0 comments on commit 46c5919

Please sign in to comment.