use of com.aviary.android.feather.library.services.LocalDataService in project mobile-android by photo.
the class FeatherActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
onPreCreate();
super.onCreate(savedInstanceState);
setContentView(R.layout.feather_main);
onInitializeUtils();
initializeUI();
onRegisterReceiver();
// initiate the filter manager
mUIHandler = new MyUIHandler(this);
mFilterManager = new FilterManager(this, mUIHandler, getApiKey());
mFilterManager.setOnToolListener(this);
mFilterManager.setOnBitmapChangeListener(this);
mFilterManager.setDragLayer(mDragLayer);
// first check the validity of the incoming intent
Uri srcUri = handleIntent(getIntent());
if (srcUri == null) {
onSetResult(RESULT_CANCELED, null);
finish();
return;
}
LocalDataService data = mFilterManager.getService(LocalDataService.class);
data.setSourceImageUri(srcUri);
// download the requested image
loadImage(srcUri);
// initialize filters
delayedInitializeTools();
logger.error("MAX MEMORY", mFilterManager.getApplicationMaxMemory());
Tracker.recordTag("feather: opened");
}
use of com.aviary.android.feather.library.services.LocalDataService in project mobile-android by photo.
the class FeatherActivity method saveExif.
protected void saveExif(String path) {
logger.log("saveExif: " + path);
if (null == path) {
return;
}
LocalDataService data = mFilterManager.getService(LocalDataService.class);
ExifInterfaceWrapper newexif = null;
if (null != data) {
try {
newexif = new ExifInterfaceWrapper(path);
} catch (IOException e) {
logger.error(e.getMessage());
e.printStackTrace();
return;
}
;
Bundle bundle = data.getOriginalExifBundle();
if (null != bundle) {
try {
newexif.copyFrom(bundle);
newexif.setAttribute(ExifInterfaceWrapper.TAG_ORIENTATION, "0");
newexif.setAttribute(ExifInterfaceWrapper.TAG_SOFTWARE, "Aviary for Android " + SDK_VERSION);
// implements this to include your own tags
onSaveCustomTags(newexif);
newexif.saveAttributes();
} catch (Throwable t) {
t.printStackTrace();
logger.error(t.getMessage());
}
}
}
}
use of com.aviary.android.feather.library.services.LocalDataService in project mobile-android by photo.
the class FeatherActivity method handleIntent.
/**
* Handle the original received intent.
*
* @param intent
* the intent
* @return the uri
*/
protected Uri handleIntent(Intent intent) {
LocalDataService service = mFilterManager.getService(LocalDataService.class);
if (intent != null && intent.getData() != null) {
Uri data = intent.getData();
if (SystemUtils.isIceCreamSandwich()) {
if (data.toString().startsWith("content://com.android.gallery3d.provider")) {
// use the com.google provider, not the com.android provider ( for ICS only )
data = Uri.parse(data.toString().replace("com.android.gallery3d", "com.google.android.gallery3d"));
}
}
Bundle extras = intent.getExtras();
if (extras != null) {
Uri destUri = (Uri) extras.getParcelable(Constants.EXTRA_OUTPUT);
if (destUri != null) {
service.setDestImageUri(destUri);
String outputFormatString = extras.getString(Constants.EXTRA_OUTPUT_FORMAT);
if (outputFormatString != null) {
CompressFormat format = Bitmap.CompressFormat.valueOf(outputFormatString);
service.setOutputFormat(format);
}
}
if (extras.containsKey(Constants.EXTRA_TOOLS_LIST)) {
mToolList = Arrays.asList(extras.getStringArray(Constants.EXTRA_TOOLS_LIST));
}
if (extras.containsKey(Constants.EXTRA_HIDE_EXIT_UNSAVE_CONFIRMATION)) {
mHideExitAlertConfirmation = extras.getBoolean(Constants.EXTRA_HIDE_EXIT_UNSAVE_CONFIRMATION);
}
}
return data;
}
return null;
}
use of com.aviary.android.feather.library.services.LocalDataService in project mobile-android by photo.
the class FeatherActivity method onRevert.
/**
* Revert the original image.
*/
private void onRevert() {
Tracker.recordTag("feather: reset image");
LocalDataService service = mFilterManager.getService(LocalDataService.class);
loadImage(service.getSourceImageUri());
}
use of com.aviary.android.feather.library.services.LocalDataService in project mobile-android by photo.
the class FeatherActivity method loadExif.
/**
* load the original file EXIF data and store the result into the local data instance
*/
protected void loadExif() {
logger.log("loadExif");
final LocalDataService data = mFilterManager.getService(LocalDataService.class);
ThreadPoolService thread = mFilterManager.getService(ThreadPoolService.class);
if (null != data && thread != null) {
final String path = data.getSourceImagePath();
FutureListener<Bundle> listener = new FutureListener<Bundle>() {
@Override
public void onFutureDone(Future<Bundle> future) {
try {
Bundle result = future.get();
if (null != result) {
data.setOriginalExifBundle(result);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
};
if (null != path) {
thread.submit(new ExifTask(), listener, path);
} else {
logger.warning("orinal file path not available");
}
}
}
Aggregations