mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-04 02:13:07 +02:00
Merge heads
This commit is contained in:
@@ -101,7 +101,7 @@ public class MarkerDetailFragment extends Fragment {
|
||||
inflater.inflate(R.menu.marker_detail, menu);
|
||||
|
||||
updateWaypoint(false);
|
||||
|
||||
|
||||
Track track = myTracksProviderUtils.getTrack(waypoint.getTrackId());
|
||||
boolean isSharedWithMe = track != null ? track.isSharedWithMe() : true;
|
||||
|
||||
@@ -114,7 +114,7 @@ public class MarkerDetailFragment extends Fragment {
|
||||
long markerId = getArguments().getLong(KEY_MARKER_ID);
|
||||
FragmentActivity fragmentActivity = getActivity();
|
||||
Intent intent;
|
||||
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.id.marker_detail_show_on_map:
|
||||
intent = IntentUtils.newIntent(fragmentActivity, TrackDetailActivity.class)
|
||||
@@ -153,6 +153,7 @@ public class MarkerDetailFragment extends Fragment {
|
||||
/**
|
||||
* Updates the UI.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private void update() {
|
||||
View waypointSection = getView().findViewById(R.id.marker_detail_waypoint_section);
|
||||
View statisticsSection = getView().findViewById(R.id.marker_detail_statistics_section);
|
||||
@@ -168,11 +169,8 @@ public class MarkerDetailFragment extends Fragment {
|
||||
} else {
|
||||
imageView.setVisibility(View.VISIBLE);
|
||||
Display defaultDisplay = getActivity().getWindowManager().getDefaultDisplay();
|
||||
@SuppressWarnings("deprecation")
|
||||
int displayWidth = defaultDisplay.getWidth();
|
||||
@SuppressWarnings("deprecation")
|
||||
int displayHeight = defaultDisplay.getHeight();
|
||||
PhotoUtils.setImageVew(imageView, Uri.parse(photoUrl), displayWidth, displayHeight);
|
||||
PhotoUtils.setImageVew(imageView, Uri.parse(photoUrl), defaultDisplay.getWidth(),
|
||||
defaultDisplay.getHeight(), true);
|
||||
}
|
||||
|
||||
TextView name = (TextView) getView().findViewById(R.id.marker_detail_waypoint_name);
|
||||
@@ -193,8 +191,8 @@ public class MarkerDetailFragment extends Fragment {
|
||||
TextView name = (TextView) getView().findViewById(R.id.marker_detail_statistics_name);
|
||||
name.setText(getString(R.string.generic_name_line, waypoint.getName()));
|
||||
|
||||
StatsUtils.setTripStatisticsValues(getActivity(), waypoint.getTripStatistics(),
|
||||
PreferencesUtils.RECORDING_TRACK_ID_DEFAULT);
|
||||
StatsUtils.setTripStatisticsValues(
|
||||
getActivity(), waypoint.getTripStatistics(), PreferencesUtils.RECORDING_TRACK_ID_DEFAULT);
|
||||
StatsUtils.setLocationValues(getActivity(), waypoint.getLocation(), false);
|
||||
}
|
||||
}
|
||||
|
||||
+51
-9
@@ -19,14 +19,18 @@ package com.google.android.apps.mytracks.io.file.exporter;
|
||||
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
||||
import com.google.android.apps.mytracks.content.Track;
|
||||
import com.google.android.apps.mytracks.content.Waypoint;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
@@ -38,7 +42,7 @@ import java.util.zip.ZipOutputStream;
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class KmzTrackExporter implements TrackExporter {
|
||||
|
||||
|
||||
public static final String KMZ_EXTENSION = "kmz";
|
||||
public static final String KMZ_IMAGES_DIR = "images";
|
||||
public static final String KMZ_KML_FILE = "doc.kml";
|
||||
@@ -49,6 +53,7 @@ public class KmzTrackExporter implements TrackExporter {
|
||||
private final MyTracksProviderUtils myTracksProviderUtils;
|
||||
private final FileTrackExporter fileTrackExporter;
|
||||
private final Track[] tracks;
|
||||
private final long photoSize;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -56,12 +61,15 @@ public class KmzTrackExporter implements TrackExporter {
|
||||
* @param myTracksProviderUtils the my tracks provider utils
|
||||
* @param fileTrackExporter the file track exporter
|
||||
* @param tracks the tracks to export
|
||||
* @param context the context
|
||||
*/
|
||||
public KmzTrackExporter(MyTracksProviderUtils myTracksProviderUtils,
|
||||
FileTrackExporter fileTrackExporter, Track[] tracks) {
|
||||
FileTrackExporter fileTrackExporter, Track[] tracks, Context context) {
|
||||
this.myTracksProviderUtils = myTracksProviderUtils;
|
||||
this.fileTrackExporter = fileTrackExporter;
|
||||
this.tracks = tracks;
|
||||
this.photoSize = PreferencesUtils.getInt(
|
||||
context, R.string.photo_size_key, PreferencesUtils.PHOTO_SIZE_DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,7 +86,7 @@ public class KmzTrackExporter implements TrackExporter {
|
||||
zipOutputStream.closeEntry();
|
||||
if (!success) {
|
||||
Log.e(TAG, "Unable to write kml in kmz");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add photos
|
||||
@@ -95,7 +103,7 @@ public class KmzTrackExporter implements TrackExporter {
|
||||
try {
|
||||
zipOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Unable to close zip input stream", e);;
|
||||
Log.e(TAG, "Unable to close zip input stream", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,10 +140,47 @@ public class KmzTrackExporter implements TrackExporter {
|
||||
|
||||
private void addImage(ZipOutputStream zipOutputStream, String photoUrl) throws IOException {
|
||||
Uri uri = Uri.parse(photoUrl);
|
||||
File file = new File(uri.getPath());
|
||||
if (!file.exists()) {
|
||||
Log.e(TAG, "file not found " + photoUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
ZipEntry zipEntry = new ZipEntry(
|
||||
KMZ_IMAGES_DIR + File.separatorChar + uri.getLastPathSegment());
|
||||
zipOutputStream.putNextEntry(zipEntry);
|
||||
|
||||
int sampleSize;
|
||||
if (photoSize == -1) {
|
||||
sampleSize = 1;
|
||||
} else {
|
||||
long size = file.length();
|
||||
// Convert from kilobytes to bytes.
|
||||
long limit = photoSize * 1024;
|
||||
sampleSize = size > limit ? (int) Math.ceil(size / limit) : 1;
|
||||
}
|
||||
if (sampleSize == 1) {
|
||||
readFromFile(zipOutputStream, uri);
|
||||
} else {
|
||||
readFromScaledBitmap(zipOutputStream, uri, sampleSize);
|
||||
}
|
||||
zipOutputStream.closeEntry();
|
||||
}
|
||||
|
||||
private void readFromScaledBitmap(ZipOutputStream zipOutputStream, Uri uri, int sampleSize) {
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = false;
|
||||
options.inSampleSize = sampleSize;
|
||||
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(uri.getPath(), options);
|
||||
if (bitmap == null) {
|
||||
return;
|
||||
}
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, zipOutputStream);
|
||||
bitmap.recycle();
|
||||
}
|
||||
|
||||
private void readFromFile(ZipOutputStream zipOutputStream, Uri uri) throws IOException {
|
||||
FileInputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = new FileInputStream(new File(uri.getPath()));
|
||||
@@ -143,14 +188,11 @@ public class KmzTrackExporter implements TrackExporter {
|
||||
int byteCount = 0;
|
||||
while ((byteCount = fileInputStream.read(buffer)) != -1) {
|
||||
zipOutputStream.write(buffer, 0, byteCount);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.e(TAG, "Unable to add image", e);
|
||||
}
|
||||
} finally {
|
||||
if (fileInputStream != null) {
|
||||
fileInputStream.close();
|
||||
}
|
||||
}
|
||||
zipOutputStream.closeEntry();
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,8 @@ public class SaveAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
||||
}
|
||||
});
|
||||
|
||||
trackExporter = useKmz ? new KmzTrackExporter(myTracksProviderUtils, fileTrackExporter, tracks)
|
||||
trackExporter = useKmz ? new KmzTrackExporter(
|
||||
myTracksProviderUtils, fileTrackExporter, tracks, context)
|
||||
: fileTrackExporter;
|
||||
|
||||
String fileName = FileUtils.buildUniqueFileName(directory, track.getName(), extension);
|
||||
|
||||
@@ -469,7 +469,7 @@ public class SyncUtils {
|
||||
FileTrackExporter fileTrackExporter = new FileTrackExporter(
|
||||
myTracksProviderUtils, tracks, TrackFileFormat.KML.newTrackWriter(context, false), null);
|
||||
TrackExporter trackExporter = useKmz ? new KmzTrackExporter(
|
||||
myTracksProviderUtils, fileTrackExporter, tracks)
|
||||
myTracksProviderUtils, fileTrackExporter, tracks, context)
|
||||
: fileTrackExporter;
|
||||
|
||||
FileOutputStream fileOutputStream = null;
|
||||
|
||||
@@ -40,16 +40,19 @@ public class BitmapLoader extends AsyncTask<Void, Void, Bitmap> {
|
||||
|
||||
private final WeakReference<ImageView> imageViewReference;
|
||||
private final Uri uri;
|
||||
private final int displayWidth;
|
||||
private final int displayHeight;
|
||||
private final int targetWidth;
|
||||
private final int targetHeight;
|
||||
private final boolean fitWithin;
|
||||
|
||||
public BitmapLoader(ImageView imageView, Uri uri, int displayWidth, int displayHeight) {
|
||||
public BitmapLoader(
|
||||
ImageView imageView, Uri uri, int targetWidth, int targetHeight, boolean fitWithin) {
|
||||
|
||||
// Use a WeakReference to ensure the ImageView can be garbage collected
|
||||
imageViewReference = new WeakReference<ImageView>(imageView);
|
||||
this.uri = uri;
|
||||
this.displayWidth = displayWidth;
|
||||
this.displayHeight = displayHeight;
|
||||
this.targetWidth = targetWidth;
|
||||
this.targetHeight = targetHeight;
|
||||
this.fitWithin = fitWithin;
|
||||
}
|
||||
|
||||
public Uri getUri() {
|
||||
@@ -64,12 +67,9 @@ public class BitmapLoader extends AsyncTask<Void, Void, Bitmap> {
|
||||
|
||||
options.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeFile(uri.getPath(), options);
|
||||
|
||||
// Set targetWidth and targetHeight
|
||||
int targetWidth = displayWidth;
|
||||
int targetHeight = displayHeight;
|
||||
if (targetHeight == 0) {
|
||||
targetHeight = (int) (targetWidth * ((float) options.outHeight / (float) options.outWidth));
|
||||
|
||||
if (options.outWidth == 0 || options.outHeight == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set imageWidth and imageHeight based on image rotation
|
||||
@@ -87,20 +87,29 @@ public class BitmapLoader extends AsyncTask<Void, Void, Bitmap> {
|
||||
|
||||
// Get a scaled down version of the image
|
||||
options.inJustDecodeBounds = false;
|
||||
options.inSampleSize = getInSampleSize(imageWidth, imageHeight, targetWidth, targetHeight);
|
||||
options.inSampleSize = getInSampleSize(imageWidth, imageHeight);
|
||||
options.inPurgeable = true;
|
||||
|
||||
Bitmap scaledBitmap = BitmapFactory.decodeFile(uri.getPath(), options);
|
||||
|
||||
if (scaledBitmap == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the final bitmap after rotating the scaled down image
|
||||
Bitmap bitmap;
|
||||
if (rotation == 0) {
|
||||
if (rotation == 0 && fitWithin) {
|
||||
bitmap = scaledBitmap;
|
||||
} else {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postRotate(rotation);
|
||||
int offset = 0;
|
||||
int height = scaledBitmap.getHeight();
|
||||
if (!fitWithin && height > targetHeight) {
|
||||
offset = (height - targetHeight) / 2;
|
||||
height = targetHeight;
|
||||
}
|
||||
bitmap = Bitmap.createBitmap(
|
||||
scaledBitmap, 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix, true);
|
||||
scaledBitmap, 0, offset, scaledBitmap.getWidth(), height, matrix, true);
|
||||
scaledBitmap.recycle();
|
||||
}
|
||||
return bitmap;
|
||||
@@ -148,10 +157,8 @@ public class BitmapLoader extends AsyncTask<Void, Void, Bitmap> {
|
||||
*
|
||||
* @param imageWidth the image width
|
||||
* @param imageHeight the image height
|
||||
* @param targetWidth the target width
|
||||
* @param targetHeight the target height
|
||||
*/
|
||||
private int getInSampleSize(int imageWidth, int imageHeight, int targetWidth, int targetHeight) {
|
||||
private int getInSampleSize(int imageWidth, int imageHeight) {
|
||||
float widthRatio = 1;
|
||||
if (imageWidth > targetWidth) {
|
||||
widthRatio = (float) imageWidth / (float) targetWidth;
|
||||
@@ -162,11 +169,21 @@ public class BitmapLoader extends AsyncTask<Void, Void, Bitmap> {
|
||||
heightRatio = (float) imageHeight / (float) targetHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
* To fit within the target area, return the larger sample ratio so the
|
||||
* image will not be larger than the target dimensions. Use Math.floor to
|
||||
* not under sample.
|
||||
*/
|
||||
return (int) Math.floor(Math.max(widthRatio, heightRatio));
|
||||
double size;
|
||||
if (fitWithin) {
|
||||
/*
|
||||
* To fit within the target area, return the larger sample ratio so the
|
||||
* image will not be larger than the target dimensions.
|
||||
*/
|
||||
size = Math.max(widthRatio, heightRatio);
|
||||
} else {
|
||||
/*
|
||||
* To fill the target area, return the smaller ratio so the image will
|
||||
* cover both dimensions.
|
||||
*/
|
||||
size = Math.min(widthRatio, heightRatio);
|
||||
}
|
||||
// Use Math.floor to not under-sample.
|
||||
return (int) Math.floor(size);
|
||||
}
|
||||
}
|
||||
|
||||
+31
-3
@@ -17,21 +17,23 @@
|
||||
package com.google.android.apps.mytracks.settings;
|
||||
|
||||
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceChangeListener;
|
||||
|
||||
/**
|
||||
* An activity for accessing the sharing settings.
|
||||
* An activity for advanced settings.
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public class SharingSettingsActivity extends AbstractSettingsActivity {
|
||||
public class AdvancedSettingsActivity extends AbstractSettingsActivity {
|
||||
|
||||
private static final int DIALOG_CONFIRM_ALLOW_ACCESS_ID = 0;
|
||||
|
||||
@@ -41,7 +43,7 @@ public class SharingSettingsActivity extends AbstractSettingsActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(R.xml.sharing_settings);
|
||||
addPreferencesFromResource(R.xml.advanced_settings);
|
||||
|
||||
allowAccessCheckBoxPreference = (CheckBoxPreference) findPreference(
|
||||
getString(R.string.allow_access_key));
|
||||
@@ -56,6 +58,15 @@ public class SharingSettingsActivity extends AbstractSettingsActivity {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ListPreference preference = (ListPreference) findPreference(getString(R.string.photo_size_key));
|
||||
int value = PreferencesUtils.getInt(
|
||||
this, R.string.photo_size_key, PreferencesUtils.PHOTO_SIZE_DEFAULT);
|
||||
String[] values = getResources().getStringArray(R.array.photo_size_values);
|
||||
String[] options = new String[values.length];
|
||||
String[] summary = new String[values.length];
|
||||
setPhotoSizeSummaryAndOptions(summary, options, values);
|
||||
configureListPreference(preference, summary, options, values, String.valueOf(value), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,4 +84,21 @@ public class SharingSettingsActivity extends AbstractSettingsActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setPhotoSizeSummaryAndOptions(String[] summary, String[] options, String[] values) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
int value = Integer.parseInt(values[i]);
|
||||
if (value == -1) {
|
||||
options[i] = getString(R.string.settings_advanced_photo_size_original);
|
||||
summary[i] = getString(R.string.settings_advanced_photo_size_original);
|
||||
} else if (value < 1024) {
|
||||
options[i] = getString(R.string.value_integer_kilobyte, value);
|
||||
summary[i] = getString(R.string.settings_advanced_photo_size_summary, options[i]);
|
||||
} else {
|
||||
int megabyte = value / 1024;
|
||||
options[i] = getString(R.string.value_integer_megabyte, megabyte);
|
||||
summary[i] = getString(R.string.settings_advanced_photo_size_summary, options[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,9 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
||||
configPreference(R.string.settings_chart_key, ChartSettingsActivity.class);
|
||||
configPreference(R.string.settings_stats_key, StatsSettingsActivity.class);
|
||||
configPreference(R.string.settings_recording_key, RecordingSettingsActivity.class);
|
||||
configPreference(R.string.settings_sharing_key, SharingSettingsActivity.class);
|
||||
configPreference(R.string.settings_sensor_key, SensorSettingsActivity.class);
|
||||
configPreference(R.string.settings_backup_reset_key, BackupResetSettingsActivity.class);
|
||||
configPreference(R.string.settings_advanced_key, AdvancedSettingsActivity.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.net.Uri;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.Display;
|
||||
@@ -36,6 +37,8 @@ import java.util.Calendar;
|
||||
*/
|
||||
public class ListItemUtils {
|
||||
|
||||
private static final int LIST_PREFERRED_ITEM_HEIGHT_DEFAULT = 128;
|
||||
|
||||
private ListItemUtils() {}
|
||||
|
||||
/**
|
||||
@@ -56,6 +59,7 @@ public class ListItemUtils {
|
||||
* @param category the category value
|
||||
* @param description the description value
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void setListItem(Activity activity, View view, boolean isRecording,
|
||||
boolean isPaused, int iconId, int iconContentDescriptionId, String name, String sharedOwner,
|
||||
String totalTime, String totalDistance, String photoUrl, long startTime, String category,
|
||||
@@ -87,17 +91,14 @@ public class ListItemUtils {
|
||||
setTextView(timeDistanceTextView,
|
||||
getTimeDistance(activity, isRecording, isPaused, sharedOwner, totalTime, totalDistance));
|
||||
|
||||
// Set photoUrl
|
||||
ImageView photo = (ImageView) view.findViewById(R.id.list_item_photo);
|
||||
ImageView photo = (ImageView) view.findViewById(R.id.list_item_background);
|
||||
if (photoUrl == null || photoUrl.equals("")) {
|
||||
photo.setVisibility(View.GONE);
|
||||
} else {
|
||||
photo.setVisibility(View.VISIBLE);
|
||||
Display defaultDisplay = activity.getWindowManager().getDefaultDisplay();
|
||||
// Set the initial width to 33% of the display width.
|
||||
int width = (int) (defaultDisplay.getWidth() * .33);
|
||||
int height = 0;
|
||||
PhotoUtils.setImageVew(photo, Uri.parse(photoUrl), width, height);
|
||||
PhotoUtils.setImageVew(
|
||||
photo, Uri.parse(photoUrl), defaultDisplay.getWidth(), getPhotoHeight(activity), false);
|
||||
}
|
||||
|
||||
// Set date/time
|
||||
@@ -108,6 +109,15 @@ public class ListItemUtils {
|
||||
TextView timeTextView = (TextView) view.findViewById(R.id.list_item_time);
|
||||
setTextView(timeTextView, startTimeDisplay[1]);
|
||||
|
||||
/*
|
||||
* If column0 is GONE, change to INVISIBLE so column1 is placed at the
|
||||
* correct position.
|
||||
*/
|
||||
if (timeTextView.getVisibility() == View.VISIBLE
|
||||
&& timeDistanceTextView.getVisibility() == View.GONE) {
|
||||
timeDistanceTextView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
// Set category/description
|
||||
TextView descriptionTextView = (TextView) view.findViewById(R.id.list_item_description);
|
||||
setTextView(descriptionTextView,
|
||||
@@ -201,4 +211,17 @@ public class ListItemUtils {
|
||||
textView.setText(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the photo height.
|
||||
*
|
||||
* @param context the context
|
||||
*/
|
||||
private static int getPhotoHeight(Context context) {
|
||||
int[] attrs = new int[] { android.R.attr.listPreferredItemHeight };
|
||||
TypedArray typeArray = context.obtainStyledAttributes(attrs);
|
||||
int height = typeArray.getDimensionPixelSize(0, LIST_PREFERRED_ITEM_HEIGHT_DEFAULT);
|
||||
typeArray.recycle();
|
||||
return 2 * height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,13 +37,17 @@ public class PhotoUtils {
|
||||
*
|
||||
* @param imageView the image view
|
||||
* @param uri the image uri
|
||||
* @param displayWidth the display width
|
||||
* @param displayHeight the display height
|
||||
* @param targetWidth the target width
|
||||
* @param targetHeight the target height
|
||||
* @param fitWithin true to fit within the target area in order to display the
|
||||
* entire image (no cropping). False to fill the entire target area.
|
||||
* (allow cropping).
|
||||
*/
|
||||
public static void setImageVew(
|
||||
ImageView imageView, Uri uri, int displayWidth, int displayHeight) {
|
||||
ImageView imageView, Uri uri, int targetWidth, int targetHeight, boolean fitWithin) {
|
||||
if (cancelBitmapLoader(imageView, uri)) {
|
||||
BitmapLoader bitmapLoader = new BitmapLoader(imageView, uri, displayWidth, displayHeight);
|
||||
BitmapLoader bitmapLoader = new BitmapLoader(
|
||||
imageView, uri, targetWidth, targetHeight, fitWithin);
|
||||
WeakReference<BitmapLoader> bitmapLoaderReference = new WeakReference<BitmapLoader>(
|
||||
bitmapLoader);
|
||||
imageView.setTag(bitmapLoaderReference);
|
||||
|
||||
@@ -82,6 +82,7 @@ public class PreferencesUtils {
|
||||
public static final int MIN_RECORDING_INTERVAL_ADAPT_BATTERY_LIFE = -2;
|
||||
public static final int MIN_RECORDING_INTERVAL_DEFAULT = 0;
|
||||
|
||||
public static final int PHOTO_SIZE_DEFAULT = 1024; // 1024 kB
|
||||
public static final int RECORDING_DISTANCE_INTERVAL_DEFAULT = 10;
|
||||
|
||||
// Values for recording_gps_accuracy
|
||||
|
||||
Reference in New Issue
Block a user