| [15393] | 1 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/GalleryAdapter.java
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/GalleryAdapter.java (revision 15012)
|
|---|
| 4 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/GalleryAdapter.java (revision 15013)
|
|---|
| 5 | @@ -3,7 +3,6 @@
|
|---|
| 6 | import java.util.List;
|
|---|
| 7 |
|
|---|
| 8 | import android.app.Activity;
|
|---|
| 9 | -import android.graphics.drawable.Drawable;
|
|---|
| 10 | import android.view.View;
|
|---|
| 11 | import android.view.ViewGroup;
|
|---|
| 12 | import android.widget.BaseAdapter;
|
|---|
| 13 | @@ -16,17 +15,17 @@
|
|---|
| 14 |
|
|---|
| 15 | private static ImageView imageView;
|
|---|
| 16 |
|
|---|
| 17 | - private List<Drawable> plotsImages;
|
|---|
| 18 | -
|
|---|
| 19 | +
|
|---|
| 20 | + private List<Integer> plotsImages;
|
|---|
| 21 | private static ViewHolder holder;
|
|---|
| 22 | +
|
|---|
| 23 | + public GalleryAdapter(Activity context, List<Integer> plotsImages)
|
|---|
| 24 | + {
|
|---|
| 25 | + this.context = context;
|
|---|
| 26 | + this.plotsImages = plotsImages;
|
|---|
| 27 | + }
|
|---|
| 28 |
|
|---|
| 29 | - public GalleryAdapter(Activity context, List<Drawable> plotsImages) {
|
|---|
| 30 |
|
|---|
| 31 | - this.context = context;
|
|---|
| 32 | - this.plotsImages = plotsImages;
|
|---|
| 33 | -
|
|---|
| 34 | - }
|
|---|
| 35 | -
|
|---|
| 36 | @Override
|
|---|
| 37 | public int getCount() {
|
|---|
| 38 | return plotsImages.size();
|
|---|
| 39 | @@ -64,8 +63,8 @@
|
|---|
| 40 | holder = (ViewHolder) convertView.getTag();
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | - holder.imageView.setImageDrawable(plotsImages.get(position));
|
|---|
| 44 | -
|
|---|
| 45 | +
|
|---|
| 46 | + holder.imageView.setImageBitmap(ImageList.getImageList().get(position));
|
|---|
| 47 | holder.imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
|---|
| 48 | holder.imageView.setLayoutParams(new Gallery.LayoutParams(150, 90));
|
|---|
| 49 |
|
|---|
| 50 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/MenuPage.java
|
|---|
| 51 | ===================================================================
|
|---|
| 52 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/MenuPage.java (revision 15012)
|
|---|
| 53 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/MenuPage.java (revision 15013)
|
|---|
| 54 | @@ -12,7 +12,7 @@
|
|---|
| 55 | public class MenuPage extends Activity
|
|---|
| 56 | {
|
|---|
| 57 | ISSM issm = new ISSM();
|
|---|
| 58 | - GalleryImage gallery = new GalleryImage();
|
|---|
| 59 | + //GalleryImage gallery = new GalleryImage();
|
|---|
| 60 | private String issmFolder;
|
|---|
| 61 | //------------------------------------------------------------------------
|
|---|
| 62 | public void onCreate(Bundle icicle)
|
|---|
| 63 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/GalleryImage.java
|
|---|
| 64 | ===================================================================
|
|---|
| 65 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/GalleryImage.java (revision 15012)
|
|---|
| 66 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/GalleryImage.java (revision 15013)
|
|---|
| 67 | @@ -5,8 +5,6 @@
|
|---|
| 68 | import android.app.Activity;
|
|---|
| 69 | import android.content.Intent;
|
|---|
| 70 | import android.graphics.Bitmap;
|
|---|
| 71 | -import android.graphics.drawable.BitmapDrawable;
|
|---|
| 72 | -import android.graphics.drawable.Drawable;
|
|---|
| 73 | import android.os.Bundle;
|
|---|
| 74 | import android.view.View;
|
|---|
| 75 | import android.view.View.OnClickListener;
|
|---|
| 76 | @@ -33,7 +31,8 @@
|
|---|
| 77 |
|
|---|
| 78 | private int selectedImagePosition = 0;
|
|---|
| 79 |
|
|---|
| 80 | - private List<Drawable> drawables;
|
|---|
| 81 | + //private List<Drawable> drawables;
|
|---|
| 82 | + private List<Integer> drawables;
|
|---|
| 83 |
|
|---|
| 84 | private GalleryAdapter galImageAdapter;
|
|---|
| 85 |
|
|---|
| 86 | @@ -184,19 +183,23 @@
|
|---|
| 87 |
|
|---|
| 88 | private void getDrawablesList() {
|
|---|
| 89 |
|
|---|
| 90 | - drawables = new ArrayList<Drawable>();
|
|---|
| 91 | -
|
|---|
| 92 | + drawables = new ArrayList<Integer>();
|
|---|
| 93 | + int resID;
|
|---|
| 94 | for (int i = 0; i < 17; i++)
|
|---|
| 95 | {
|
|---|
| 96 | - drawables.add(getResources().getDrawable(getResources().getIdentifier("image"+i, "drawable", getPackageName())));
|
|---|
| 97 | + resID=getResources().getIdentifier("image"+i, "drawable", getPackageName());
|
|---|
| 98 | + drawables.add(resID);
|
|---|
| 99 | +
|
|---|
| 100 | }
|
|---|
| 101 | -
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | private void setSelectedImage(int selectedImagePosition) {
|
|---|
| 105 | -
|
|---|
| 106 | - BitmapDrawable bd = (BitmapDrawable) drawables.get(selectedImagePosition);
|
|---|
| 107 | - Bitmap b = Bitmap.createScaledBitmap(bd.getBitmap(), (int) (bd.getIntrinsicHeight() * 0.9), (int) (bd.getIntrinsicWidth() * 0.7), false);
|
|---|
| 108 | +
|
|---|
| 109 | + int width= getResources().getDisplayMetrics().widthPixels;
|
|---|
| 110 | + int height= getResources().getDisplayMetrics().heightPixels;
|
|---|
| 111 | + Bitmap b;
|
|---|
| 112 | + b = ImageResizer.decodeSampledBitmapFromResource(getResources(), drawables.get(selectedImagePosition), width, height);
|
|---|
| 113 | + b = Bitmap.createScaledBitmap(b, width, height, true);
|
|---|
| 114 | selectedImageView.setImageBitmap(b);
|
|---|
| 115 | selectedImageView.setScaleType(ScaleType.FIT_XY);
|
|---|
| 116 | selectedTextView.setText(description.getDescription(selectedImagePosition ));
|
|---|
| 117 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ColorBar.java
|
|---|
| 118 | ===================================================================
|
|---|
| 119 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ColorBar.java (revision 15012)
|
|---|
| 120 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ColorBar.java (revision 15013)
|
|---|
| 121 | @@ -1,13 +1,10 @@
|
|---|
| 122 | package gov.nasa.jpl.issm;
|
|---|
| 123 |
|
|---|
| 124 | -import java.text.DecimalFormat;
|
|---|
| 125 | -
|
|---|
| 126 | import android.content.Context;
|
|---|
| 127 | import android.graphics.Canvas;
|
|---|
| 128 | import android.graphics.Color;
|
|---|
| 129 | import android.graphics.Paint;
|
|---|
| 130 | import android.util.AttributeSet;
|
|---|
| 131 | -import android.view.MotionEvent;
|
|---|
| 132 | import android.view.View;
|
|---|
| 133 | /////////////////////////////////////////////////////////////
|
|---|
| 134 | public class ColorBar extends View
|
|---|
| 135 | @@ -18,7 +15,7 @@
|
|---|
| 136 | private int width = 30;
|
|---|
| 137 | private int start_x = 10;
|
|---|
| 138 | private int start_y = 10;
|
|---|
| 139 | - private int end_y = 0;
|
|---|
| 140 | + //private int end_y = 0;
|
|---|
| 141 | boolean touch;
|
|---|
| 142 | final int MAX_SCALING =255;
|
|---|
| 143 | double [][] colorBuffer;
|
|---|
| 144 | @@ -75,7 +72,7 @@
|
|---|
| 145 | }
|
|---|
| 146 | y+=3;
|
|---|
| 147 | }
|
|---|
| 148 | - end_y = y;
|
|---|
| 149 | + //end_y = y;
|
|---|
| 150 | }
|
|---|
| 151 | //----------------------------------------------------------------
|
|---|
| 152 | /*allow user to move color bar around
|
|---|
| 153 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSM.java
|
|---|
| 154 | ===================================================================
|
|---|
| 155 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSM.java (revision 15012)
|
|---|
| 156 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSM.java (revision 15013)
|
|---|
| 157 | @@ -8,7 +8,6 @@
|
|---|
| 158 | import android.os.Bundle;
|
|---|
| 159 | import android.app.Activity;
|
|---|
| 160 | import android.app.ProgressDialog;
|
|---|
| 161 | -import android.graphics.Matrix;
|
|---|
| 162 | import android.util.DisplayMetrics;
|
|---|
| 163 | import android.view.GestureDetector;
|
|---|
| 164 | import android.view.Gravity;
|
|---|
| 165 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSMAPP.java
|
|---|
| 166 | ===================================================================
|
|---|
| 167 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSMAPP.java (revision 15012)
|
|---|
| 168 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSMAPP.java (revision 15013)
|
|---|
| 169 | @@ -6,6 +6,7 @@
|
|---|
| 170 | import java.io.InputStream;
|
|---|
| 171 | import java.io.OutputStream;
|
|---|
| 172 | import android.app.Activity;
|
|---|
| 173 | +import android.app.ProgressDialog;
|
|---|
| 174 | import android.os.AsyncTask;
|
|---|
| 175 | import android.os.Bundle;
|
|---|
| 176 | import android.os.Environment;
|
|---|
| 177 | @@ -21,11 +22,12 @@
|
|---|
| 178 | ///////////////////////////////////////////////////////////////////////////
|
|---|
| 179 | public class ISSMAPP extends Activity
|
|---|
| 180 | {
|
|---|
| 181 | - MenuPage mp = new MenuPage();
|
|---|
| 182 | + ImageList imageList;
|
|---|
| 183 | private static final String PREFERENCE_FIRST_RUN = null;
|
|---|
| 184 | private String extStorageDirectory;
|
|---|
| 185 | private String issmFolder;
|
|---|
| 186 | SharedPreferences settings;
|
|---|
| 187 | + private ProgressDialog progressDialog;
|
|---|
| 188 | //------------------------------------------------------------------------
|
|---|
| 189 | public void onCreate(Bundle icicle)
|
|---|
| 190 | {
|
|---|
| 191 | @@ -35,7 +37,7 @@
|
|---|
| 192 | boolean firstrun = settings.getBoolean(PREFERENCE_FIRST_RUN, true);
|
|---|
| 193 | extStorageDirectory = Environment.getExternalStorageDirectory().toString();
|
|---|
| 194 | issmFolder = extStorageDirectory + "/ISSM/input_files/";
|
|---|
| 195 | -
|
|---|
| 196 | + imageList = new ImageList(this);
|
|---|
| 197 | new CopyDataTask().execute(firstrun);
|
|---|
| 198 | }
|
|---|
| 199 | //-------------------------------------------------------------------------------------------
|
|---|
| 200 | @@ -46,13 +48,7 @@
|
|---|
| 201 | @Override
|
|---|
| 202 | protected Boolean doInBackground(Boolean... target)
|
|---|
| 203 | {
|
|---|
| 204 | - StartAnimations();
|
|---|
| 205 | - try {
|
|---|
| 206 | - Thread.sleep(3000);
|
|---|
| 207 | - } catch (InterruptedException e1) {
|
|---|
| 208 | - // TODO Auto-generated catch block
|
|---|
| 209 | - e1.printStackTrace();
|
|---|
| 210 | - }
|
|---|
| 211 | + imageList.decodeAndResizeImage();
|
|---|
| 212 | //not sure why, but target[0] can be true on install! more to be done.
|
|---|
| 213 | //if(target[0] = false)
|
|---|
| 214 | //{
|
|---|
| 215 | @@ -65,8 +61,18 @@
|
|---|
| 216 | //}
|
|---|
| 217 | return true;
|
|---|
| 218 | }
|
|---|
| 219 | + @Override
|
|---|
| 220 | + protected void onPreExecute()
|
|---|
| 221 | + {
|
|---|
| 222 | + progressDialog = new ProgressDialog(ISSMAPP.this);
|
|---|
| 223 | + progressDialog.setMessage("Loading Data");
|
|---|
| 224 | + progressDialog.setIndeterminate(true);
|
|---|
| 225 | + progressDialog.setCancelable(false);
|
|---|
| 226 | + progressDialog.show();
|
|---|
| 227 | + }
|
|---|
| 228 | protected void onPostExecute(Boolean result)
|
|---|
| 229 | {
|
|---|
| 230 | + progressDialog.dismiss();
|
|---|
| 231 | Intent i = new Intent(ISSMAPP.this, MenuPage.class);
|
|---|
| 232 | i.putExtra("pathToFile", issmFolder);
|
|---|
| 233 | startActivity(i);
|
|---|
| 234 | @@ -77,14 +83,12 @@
|
|---|
| 235 | {
|
|---|
| 236 | if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED))
|
|---|
| 237 | {
|
|---|
| 238 | - System.out.println(issmFolder);
|
|---|
| 239 | File txtDirectory = new File(issmFolder);
|
|---|
| 240 |
|
|---|
| 241 | // Check and create directory in SDcard
|
|---|
| 242 | if(!txtDirectory.exists())
|
|---|
| 243 | {
|
|---|
| 244 | txtDirectory.mkdirs();
|
|---|
| 245 | - System.out.println("making directory");
|
|---|
| 246 | }
|
|---|
| 247 | CopyAssets(); // Then run the method to copy the file.
|
|---|
| 248 |
|
|---|
| 249 | @@ -126,7 +130,6 @@
|
|---|
| 250 | Log.e("tag", e.getMessage());
|
|---|
| 251 | }
|
|---|
| 252 | }
|
|---|
| 253 | - System.out.println("Done");
|
|---|
| 254 | }
|
|---|
| 255 | //----------------------------------------------------------------------------
|
|---|
| 256 | private void copyFile(InputStream in, OutputStream out) throws IOException
|
|---|
| 257 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ImageList.java
|
|---|
| 258 | ===================================================================
|
|---|
| 259 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ImageList.java (revision 0)
|
|---|
| 260 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ImageList.java (revision 15013)
|
|---|
| 261 | @@ -0,0 +1,34 @@
|
|---|
| 262 | +package gov.nasa.jpl.issm;
|
|---|
| 263 | +
|
|---|
| 264 | +import java.util.ArrayList;
|
|---|
| 265 | +
|
|---|
| 266 | +import android.content.Context;
|
|---|
| 267 | +import android.graphics.Bitmap;
|
|---|
| 268 | +
|
|---|
| 269 | +public class ImageList
|
|---|
| 270 | +{
|
|---|
| 271 | + private static ArrayList <Bitmap> imageList;
|
|---|
| 272 | + private Context context;
|
|---|
| 273 | + final int nImage = 17;
|
|---|
| 274 | +//----------------------------------------------------------
|
|---|
| 275 | + public ImageList(Context context)
|
|---|
| 276 | + {
|
|---|
| 277 | + imageList = new ArrayList <Bitmap>();
|
|---|
| 278 | + this.context = context;
|
|---|
| 279 | + }
|
|---|
| 280 | +//----------------------------------------------------------
|
|---|
| 281 | + public void decodeAndResizeImage()
|
|---|
| 282 | + {
|
|---|
| 283 | + int resID;
|
|---|
| 284 | + for(int i = 0 ; i < nImage; i++)
|
|---|
| 285 | + {
|
|---|
| 286 | + resID=context.getResources().getIdentifier("image"+i, "drawable", context.getPackageName());
|
|---|
| 287 | + imageList.add(ImageResizer.decodeSampledBitmapFromResource(context.getResources(), resID , 50, 50));
|
|---|
| 288 | + }
|
|---|
| 289 | + }
|
|---|
| 290 | +//----------------------------------------------------------
|
|---|
| 291 | + public static ArrayList<Bitmap> getImageList()
|
|---|
| 292 | + {
|
|---|
| 293 | + return imageList;
|
|---|
| 294 | + }
|
|---|
| 295 | +}
|
|---|
| 296 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ZoomImageView.java
|
|---|
| 297 | ===================================================================
|
|---|
| 298 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ZoomImageView.java (revision 15012)
|
|---|
| 299 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ZoomImageView.java (revision 15013)
|
|---|
| 300 | @@ -16,7 +16,9 @@
|
|---|
| 301 | package gov.nasa.jpl.issm;
|
|---|
| 302 |
|
|---|
| 303 | import android.content.Context;
|
|---|
| 304 | +import android.graphics.Bitmap;
|
|---|
| 305 | import android.graphics.Canvas;
|
|---|
| 306 | +import android.graphics.drawable.BitmapDrawable;
|
|---|
| 307 | import android.graphics.drawable.Drawable;
|
|---|
| 308 | import android.util.AttributeSet;
|
|---|
| 309 | import android.view.MotionEvent;
|
|---|
| 310 | @@ -26,11 +28,10 @@
|
|---|
| 311 |
|
|---|
| 312 | public class ZoomImageView extends View {
|
|---|
| 313 | private static final int INVALID_POINTER_ID = -1;
|
|---|
| 314 | -
|
|---|
| 315 | + private Bitmap b;
|
|---|
| 316 | private Drawable mIcon;
|
|---|
| 317 | private float mPosX;
|
|---|
| 318 | private float mPosY;
|
|---|
| 319 | -
|
|---|
| 320 | private float mLastTouchX;
|
|---|
| 321 | private float mLastTouchY;
|
|---|
| 322 | private int mActivePointerId = INVALID_POINTER_ID;
|
|---|
| 323 | @@ -38,6 +39,7 @@
|
|---|
| 324 | private ScaleGestureDetector mScaleDetector;
|
|---|
| 325 | private float mScaleFactor = 1.f;
|
|---|
| 326 |
|
|---|
| 327 | +
|
|---|
| 328 | public ZoomImageView(Context context, int i) {
|
|---|
| 329 | this(context, null, 0, i);
|
|---|
| 330 | }
|
|---|
| 331 | @@ -46,13 +48,19 @@
|
|---|
| 332 | this(context, attrs, 0 ,i);
|
|---|
| 333 | }
|
|---|
| 334 |
|
|---|
| 335 | +
|
|---|
| 336 | public ZoomImageView(Context context, AttributeSet attrs, int defStyle, int i) {
|
|---|
| 337 | super(context, attrs, defStyle);
|
|---|
| 338 | - mIcon = getResources().getDrawable(getResources().getIdentifier("image"+i, "drawable", context.getPackageName()));
|
|---|
| 339 | + int resID2 = getResources().getIdentifier("image"+i, "drawable", context.getPackageName());
|
|---|
| 340 | + //mIcon = getResources().getDrawable(resID);
|
|---|
| 341 | int width= context.getResources().getDisplayMetrics().widthPixels;
|
|---|
| 342 | int height= context.getResources().getDisplayMetrics().heightPixels;
|
|---|
| 343 | +
|
|---|
| 344 | +
|
|---|
| 345 | + b = ImageResizer.decodeSampledBitmapFromResource(getResources(), resID2, width, height);
|
|---|
| 346 | + b = Bitmap.createScaledBitmap(b, width, height, true);
|
|---|
| 347 | + mIcon = new BitmapDrawable(getResources(), b);
|
|---|
| 348 | mIcon.setBounds(0, 0, width, height);
|
|---|
| 349 | -
|
|---|
| 350 | mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
|
|---|
| 351 | }
|
|---|
| 352 |
|
|---|
| 353 | @@ -133,6 +141,7 @@
|
|---|
| 354 | canvas.translate(mPosX, mPosY);
|
|---|
| 355 | canvas.scale(mScaleFactor, mScaleFactor);
|
|---|
| 356 | mIcon.draw(canvas);
|
|---|
| 357 | + // canvas.drawBitmap(b,0,0,null);
|
|---|
| 358 | canvas.restore();
|
|---|
| 359 | }
|
|---|
| 360 |
|
|---|
| 361 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ImageResizer.java
|
|---|
| 362 | ===================================================================
|
|---|
| 363 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ImageResizer.java (revision 0)
|
|---|
| 364 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ImageResizer.java (revision 15013)
|
|---|
| 365 | @@ -0,0 +1,49 @@
|
|---|
| 366 | +package gov.nasa.jpl.issm;
|
|---|
| 367 | +
|
|---|
| 368 | +import android.content.res.Resources;
|
|---|
| 369 | +import android.graphics.Bitmap;
|
|---|
| 370 | +import android.graphics.BitmapFactory;
|
|---|
| 371 | +
|
|---|
| 372 | +public class ImageResizer {
|
|---|
| 373 | +
|
|---|
| 374 | + public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId,
|
|---|
| 375 | + int reqWidth, int reqHeight) {
|
|---|
| 376 | +
|
|---|
| 377 | + // First decode with inJustDecodeBounds=true to check dimensions
|
|---|
| 378 | + final BitmapFactory.Options options = new BitmapFactory.Options();
|
|---|
| 379 | + options.inJustDecodeBounds = true;
|
|---|
| 380 | + BitmapFactory.decodeResource(res, resId, options);
|
|---|
| 381 | +
|
|---|
| 382 | + // Calculate inSampleSize
|
|---|
| 383 | + options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
|
|---|
| 384 | +
|
|---|
| 385 | + // Decode bitmap with inSampleSize set
|
|---|
| 386 | + options.inJustDecodeBounds = false;
|
|---|
| 387 | + return BitmapFactory.decodeResource(res, resId, options);
|
|---|
| 388 | + }
|
|---|
| 389 | +
|
|---|
| 390 | + public static int calculateInSampleSize(
|
|---|
| 391 | + BitmapFactory.Options options, int reqWidth, int reqHeight)
|
|---|
| 392 | + {
|
|---|
| 393 | + // Raw height and width of image
|
|---|
| 394 | + int height = options.outHeight;
|
|---|
| 395 | + int width = options.outWidth;
|
|---|
| 396 | + int inSampleSize = 1;
|
|---|
| 397 | +
|
|---|
| 398 | + if (height > reqHeight || width > reqWidth) {
|
|---|
| 399 | +
|
|---|
| 400 | + // Calculate ratios of height and width to requested height and width
|
|---|
| 401 | + final int heightRatio = Math.round((float) height / (float) reqHeight);
|
|---|
| 402 | + final int widthRatio = Math.round((float) width / (float) reqWidth);
|
|---|
| 403 | +
|
|---|
| 404 | + // Choose the smallest ratio as inSampleSize value, this will guarantee
|
|---|
| 405 | + // a final image with both dimensions larger than or equal to the
|
|---|
| 406 | + // requested height and width.
|
|---|
| 407 | + inSampleSize = heightRatio > widthRatio ? heightRatio : widthRatio;
|
|---|
| 408 | + }
|
|---|
| 409 | +
|
|---|
| 410 | + return inSampleSize;
|
|---|
| 411 | +
|
|---|
| 412 | + }
|
|---|
| 413 | +
|
|---|
| 414 | +}
|
|---|
| 415 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image0.png
|
|---|
| 416 | ===================================================================
|
|---|
| 417 | Cannot display: file marked as a binary type.
|
|---|
| 418 | svn:mime-type = application/octet-stream
|
|---|
| 419 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image1.png
|
|---|
| 420 | ===================================================================
|
|---|
| 421 | Cannot display: file marked as a binary type.
|
|---|
| 422 | svn:mime-type = application/octet-stream
|
|---|
| 423 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image2.png
|
|---|
| 424 | ===================================================================
|
|---|
| 425 | Cannot display: file marked as a binary type.
|
|---|
| 426 | svn:mime-type = application/octet-stream
|
|---|
| 427 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image3.png
|
|---|
| 428 | ===================================================================
|
|---|
| 429 | Cannot display: file marked as a binary type.
|
|---|
| 430 | svn:mime-type = application/octet-stream
|
|---|
| 431 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image4.png
|
|---|
| 432 | ===================================================================
|
|---|
| 433 | Cannot display: file marked as a binary type.
|
|---|
| 434 | svn:mime-type = application/octet-stream
|
|---|
| 435 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image5.png
|
|---|
| 436 | ===================================================================
|
|---|
| 437 | Cannot display: file marked as a binary type.
|
|---|
| 438 | svn:mime-type = application/octet-stream
|
|---|
| 439 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image6.png
|
|---|
| 440 | ===================================================================
|
|---|
| 441 | Cannot display: file marked as a binary type.
|
|---|
| 442 | svn:mime-type = application/octet-stream
|
|---|
| 443 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image7.png
|
|---|
| 444 | ===================================================================
|
|---|
| 445 | Cannot display: file marked as a binary type.
|
|---|
| 446 | svn:mime-type = application/octet-stream
|
|---|
| 447 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image8.png
|
|---|
| 448 | ===================================================================
|
|---|
| 449 | Cannot display: file marked as a binary type.
|
|---|
| 450 | svn:mime-type = application/octet-stream
|
|---|
| 451 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image9.png
|
|---|
| 452 | ===================================================================
|
|---|
| 453 | Cannot display: file marked as a binary type.
|
|---|
| 454 | svn:mime-type = application/octet-stream
|
|---|
| 455 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image10.png
|
|---|
| 456 | ===================================================================
|
|---|
| 457 | Cannot display: file marked as a binary type.
|
|---|
| 458 | svn:mime-type = application/octet-stream
|
|---|
| 459 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image11.png
|
|---|
| 460 | ===================================================================
|
|---|
| 461 | Cannot display: file marked as a binary type.
|
|---|
| 462 | svn:mime-type = application/octet-stream
|
|---|
| 463 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image12.png
|
|---|
| 464 | ===================================================================
|
|---|
| 465 | Cannot display: file marked as a binary type.
|
|---|
| 466 | svn:mime-type = application/octet-stream
|
|---|
| 467 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image13.png
|
|---|
| 468 | ===================================================================
|
|---|
| 469 | Cannot display: file marked as a binary type.
|
|---|
| 470 | svn:mime-type = application/octet-stream
|
|---|
| 471 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image14.png
|
|---|
| 472 | ===================================================================
|
|---|
| 473 | Cannot display: file marked as a binary type.
|
|---|
| 474 | svn:mime-type = application/octet-stream
|
|---|
| 475 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image15.png
|
|---|
| 476 | ===================================================================
|
|---|
| 477 | Cannot display: file marked as a binary type.
|
|---|
| 478 | svn:mime-type = application/octet-stream
|
|---|
| 479 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image16.png
|
|---|
| 480 | ===================================================================
|
|---|
| 481 | Cannot display: file marked as a binary type.
|
|---|
| 482 | svn:mime-type = application/octet-stream
|
|---|
| 483 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/drawable/image17.png
|
|---|
| 484 | ===================================================================
|
|---|
| 485 | Cannot display: file marked as a binary type.
|
|---|
| 486 | svn:mime-type = application/octet-stream
|
|---|
| 487 | Index: ../trunk-jpl/src/mobile/android/ISSM_APP/res/anim/translate.xml
|
|---|
| 488 | ===================================================================
|
|---|
| 489 | --- ../trunk-jpl/src/mobile/android/ISSM_APP/res/anim/translate.xml (revision 15012)
|
|---|
| 490 | +++ ../trunk-jpl/src/mobile/android/ISSM_APP/res/anim/translate.xml (revision 15013)
|
|---|
| 491 | @@ -8,7 +8,7 @@
|
|---|
| 492 | android:toXDelta="0%"
|
|---|
| 493 | android:fromYDelta="200%"
|
|---|
| 494 | android:toYDelta="0%"
|
|---|
| 495 | - android:duration="2000"
|
|---|
| 496 | + android:duration="3000"
|
|---|
| 497 | android:zAdjustment="top" />
|
|---|
| 498 |
|
|---|
| 499 | </set>
|
|---|
| 500 | \ No newline at end of file
|
|---|