use of com.aviary.android.feather.library.services.ConfigService in project mobile-android by photo.
the class CropPanel method onCreate.
/*
* (non-Javadoc)
*
* @see com.aviary.android.feather.effects.AbstractEffectPanel#onCreate(android.graphics.Bitmap)
*/
@Override
public void onCreate(Bitmap bitmap) {
super.onCreate(bitmap);
ConfigService config = getContext().getService(ConfigService.class);
mFilter = FilterLoaderFactory.get(Filters.CROP);
mCropNames = config.getStringArray(R.array.feather_crop_names);
mCropValues = config.getStringArray(R.array.feather_crop_values);
strict = config.getBoolean(R.integer.feather_crop_invert_policy);
if (!strict) {
if (bitmap.getHeight() > bitmap.getWidth()) {
mIsPortrait = true;
} else {
mIsPortrait = false;
}
// configure options that will not invert
populateInvertOptions(nonInvertOptions, mCropValues);
if (mIsPortrait) {
invertRatios(mCropNames, mCropValues);
}
}
mSelectedPosition = config.getInteger(R.integer.feather_crop_selected_value);
mImageView = (CropImageView) getContentView().findViewById(R.id.crop_image_view);
mImageView.setDoubleTapEnabled(false);
int minAreaSize = config.getInteger(R.integer.feather_crop_min_size);
((CropImageView) mImageView).setMinCropSize(minAreaSize);
mGallery = (Gallery) getOptionView().findViewById(R.id.gallery);
mGallery.setCallbackDuringFling(false);
mGallery.setSpacing(0);
mGallery.setAdapter(new GalleryAdapter(getContext().getBaseContext(), mCropNames));
mGallery.setSelection(mSelectedPosition, false, true);
}
Aggregations