Search in sources :

Example 1 with Exif

use of com.googlecode.flickrjandroid.photos.Exif in project glimmr by brk3.

the class PhotoOverviewFragment method onExifInfoReady.

public void onExifInfoReady(List<Exif> exifInfo, Exception exc) {
    mActivity.setProgressBarIndeterminateVisibility(Boolean.FALSE);
    if (FlickrHelper.getInstance().handleFlickrUnavailable(mActivity, exc)) {
        return;
    }
    for (Exif e : exifInfo) {
        String value = e.getRaw();
        if ("ISO".equals(e.getTag())) {
            styleTextView(mTextViewISO, mActivity.getString(R.string.iso), value);
        } else if ("ExposureTime".equals(e.getTag())) {
            styleTextView(mTextViewShutter, mActivity.getString(R.string.shutter), value);
        } else if ("FNumber".equals(e.getTag())) {
            value = "ƒ/" + value;
            styleTextView(mTextViewAperture, mActivity.getString(R.string.aperture), value);
        } else if ("FocalLength".equals(e.getTag())) {
            styleTextView(mTextViewFocalLength, mActivity.getString(R.string.focal_length), value);
        }
    }
    if (mActivity.getString(R.string.iso).equals(mTextViewISO.getText())) {
        styleTextView(mTextViewISO, mActivity.getString(R.string.iso), "?");
    }
    if (mActivity.getString(R.string.aperture).equals(mTextViewAperture.getText())) {
        styleTextView(mTextViewAperture, mActivity.getString(R.string.aperture), "?");
    }
    if (mActivity.getString(R.string.shutter).equals(mTextViewShutter.getText())) {
        styleTextView(mTextViewShutter, mActivity.getString(R.string.shutter), "?");
    }
    if (mActivity.getString(R.string.focal_length).equals(mTextViewFocalLength.getText())) {
        styleTextView(mTextViewFocalLength, mActivity.getString(R.string.focal_length), "?");
    }
}
Also used : Exif(com.googlecode.flickrjandroid.photos.Exif)

Example 2 with Exif

use of com.googlecode.flickrjandroid.photos.Exif in project glimmr by brk3.

the class ExifInfoFragment method onExifInfoReady.

public void onExifInfoReady(List<Exif> exifInfo, Exception exc) {
    mActivity.setProgressBarIndeterminateVisibility(Boolean.FALSE);
    if (FlickrHelper.getInstance().handleFlickrUnavailable(mActivity, exc)) {
        return;
    }
    if (FlickrHelper.getInstance().handleFlickrUnavailable(mActivity, exc)) {
        return;
    }
    /* Something went wrong, show message and return */
    if (exc != null) {
        mTextViewErrorMessage.setVisibility(View.VISIBLE);
        if (exc instanceof FlickrException) {
            String errCode = ((FlickrException) exc).getErrorCode();
            if (BuildConfig.DEBUG)
                Log.d(getLogTag(), "errCode: " + errCode);
            if (errCode != null && ERR_PERMISSION_DENIED.equals(errCode)) {
                mTextViewErrorMessage.setText(mActivity.getString(R.string.no_exif_permission));
            } else {
                mTextViewErrorMessage.setText(mActivity.getString(R.string.no_connection));
            }
        } else {
            mTextViewErrorMessage.setText(mActivity.getString(R.string.no_connection));
        }
        return;
    }
    /* Populate table with exif info */
    for (Exif e : exifInfo) {
        /* Convert camel case key to space delimited:
             * http://stackoverflow.com/a/2560017/663370 */
        String rawTag = e.getTag();
        String tagConverted = rawTag.replaceAll(String.format("%s|%s|%s", "(?<=[A-Z])(?=[A-Z][a-z])", "(?<=[^A-Z])(?=[A-Z])", "(?<=[A-Za-z])(?=[^A-Za-z])"), " ");
        addKeyValueRow(tagConverted, e.getRaw());
    }
}
Also used : Exif(com.googlecode.flickrjandroid.photos.Exif) FlickrException(com.googlecode.flickrjandroid.FlickrException)

Aggregations

Exif (com.googlecode.flickrjandroid.photos.Exif)2 FlickrException (com.googlecode.flickrjandroid.FlickrException)1