import android.widget.SeekBar;
import android.widget.ShareActionProvider;
import android.widget.ShareActionProvider.OnShareTargetSelectedListener;
+import android.widget.Toast;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.cache.ImageLoader;
}
});
- mImageLoader = new ImageLoader(getApplicationContext());
+ mImageLoader = new ImageLoader(this, getApplicationContext());
LinearLayout listFilters = (LinearLayout) findViewById(R.id.listFilters);
LinearLayout listBorders = (LinearLayout) findViewById(R.id.listBorders);
finish();
}
}
+
+ public void cannotLoadImage() {
+ CharSequence text = getString(R.string.cannot_load_image);
+ Toast toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
+ toast.show();
+ finish();
+ }
+
// //////////////////////////////////////////////////////////////////////////////
public float getPixelsFromDip(float value) {
private int mOrientation = 0;
private HistoryAdapter mAdapter = null;
+ private FilterShowActivity mActivity = null;
+
private static final int ORI_NORMAL = ExifInterface.ORIENTATION_NORMAL;
private static final int ORI_ROTATE_90 = ExifInterface.ORIENTATION_ROTATE_90;
private static final int ORI_ROTATE_180 = ExifInterface.ORIENTATION_ROTATE_180;
private Rect mOriginalBounds = null;
- public ImageLoader(Context context) {
+ public ImageLoader(FilterShowActivity activity, Context context) {
+ mActivity = activity;
mContext = context;
mCache = new DelayedPresetCache(this, 30);
mHiresCache = new DelayedPresetCache(this, 2);
mOrientation = getOrientation(uri);
mOriginalBitmapSmall = loadScaledBitmap(uri, 160);
+ if (mOriginalBitmapSmall == null) {
+ // Couldn't read the bitmap, let's exit
+ mActivity.cannotLoadImage();
+ }
mOriginalBitmapLarge = loadScaledBitmap(uri, size);
updateBitmaps();
}