Search in sources :

Example 1 with GeoLocation

use of com.drew.lang.GeoLocation in project LeafPic by HoraApps.

the class Media method getMainDetails.

public MediaDetailsMap<String, String> getMainDetails(Context context) {
    metadata = new MetadataItem(new File(path));
    MediaDetailsMap<String, String> details = new MediaDetailsMap<String, String>();
    details.put(context.getString(R.string.path), path != null ? path : getUri().getEncodedPath());
    details.put(context.getString(R.string.type), getMimeType());
    String tmp;
    if ((tmp = metadata.getResolution()) != null)
        details.put(context.getString(R.string.resolution), tmp);
    details.put(context.getString(R.string.size), StringUtils.humanReadableByteCount(size, true));
    details.put(context.getString(R.string.date), SimpleDateFormat.getDateTimeInstance().format(new Date(getDateModified())));
    details.put(context.getString(R.string.orientation), getOrientation() + "");
    if (metadata.getDateOriginal() != null)
        details.put(context.getString(R.string.date_taken), SimpleDateFormat.getDateTimeInstance().format(metadata.getDateOriginal()));
    if ((tmp = metadata.getCameraInfo()) != null)
        details.put(context.getString(R.string.camera), tmp);
    if ((tmp = metadata.getExifInfo()) != null)
        details.put(context.getString(R.string.exif), tmp);
    GeoLocation location;
    if ((location = metadata.getLocation()) != null)
        details.put(context.getString(R.string.location), location.toDMSString());
    return details;
}
Also used : MediaDetailsMap(org.horaapps.leafpic.data.base.MediaDetailsMap) GeoLocation(com.drew.lang.GeoLocation) File(java.io.File) Date(java.util.Date)

Example 2 with GeoLocation

use of com.drew.lang.GeoLocation in project LeafPic by HoraApps.

the class AlertDialogsHelper method getDetailsDialog.

public static AlertDialog getDetailsDialog(final ThemedActivity activity, AlertDialog.Builder detailsDialogBuilder, final Media f) {
    MediaDetailsMap<String, String> mainDetails = f.getMainDetails(activity.getApplicationContext());
    final View dialogLayout = activity.getLayoutInflater().inflate(org.horaapps.leafpic.R.layout.dialog_media_detail, null);
    ImageView imgMap = (ImageView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.photo_map);
    dialogLayout.findViewById(org.horaapps.leafpic.R.id.details_title).setBackgroundColor(activity.getPrimaryColor());
    ((CardView) dialogLayout.findViewById(org.horaapps.leafpic.R.id.photo_details_card)).setCardBackgroundColor(activity.getCardBackgroundColor());
    final GeoLocation location;
    if ((location = f.getGeoLocation()) != null) {
        PreferenceUtil SP = PreferenceUtil.getInstance(activity.getApplicationContext());
        StaticMapProvider staticMapProvider = StaticMapProvider.fromValue(SP.getInt(activity.getString(R.string.preference_map_provider), StaticMapProvider.GOOGLE_MAPS.getValue()));
        Glide.with(activity.getApplicationContext()).load(staticMapProvider.getUrl(location)).asBitmap().centerCrop().animate(org.horaapps.leafpic.R.anim.fade_in).into(imgMap);
        imgMap.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                String uri = String.format(Locale.ENGLISH, "geo:%f,%f?z=%d", location.getLatitude(), location.getLongitude(), 17);
                activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uri)));
            }
        });
        imgMap.setVisibility(View.VISIBLE);
        dialogLayout.findViewById(org.horaapps.leafpic.R.id.details_title).setVisibility(View.GONE);
    }
    final TextView showMoreText = (TextView) dialogLayout.findViewById(R.id.details_showmore);
    showMoreText.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            showMoreDetails(dialogLayout, activity, f);
            showMoreText.setVisibility(View.INVISIBLE);
        }
    });
    detailsDialogBuilder.setView(dialogLayout);
    loadDetails(dialogLayout, activity, mainDetails);
    return detailsDialogBuilder.create();
}
Also used : CardView(android.support.v7.widget.CardView) Intent(android.content.Intent) TextView(android.widget.TextView) ImageView(android.widget.ImageView) GeoLocation(com.drew.lang.GeoLocation) ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView)

Aggregations

GeoLocation (com.drew.lang.GeoLocation)2 Intent (android.content.Intent)1 CardView (android.support.v7.widget.CardView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 File (java.io.File)1 Date (java.util.Date)1 MediaDetailsMap (org.horaapps.leafpic.data.base.MediaDetailsMap)1