Android Open Source - issue-parser Utils






From Project

Back to project page issue-parser.

License

The source code is released under:

GNU General Public License

If you think the Android project issue-parser listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.dom.drupalit;
/* www .  j  av a  2s.  co  m*/
import java.io.IOException;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface.OnCancelListener;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;

public class Utils {

  private static ProgressDialog loadingDialog;

  public static Bitmap rotateImageWithEXIFInformation(Context context,
      Uri uri, Bitmap bitmap) {
    float rotation = 0;
    try {
      ExifInterface exif = new ExifInterface(uri.getPath());
      int rot = (int) exifOrientationToDegrees(exif.getAttributeInt(
          ExifInterface.TAG_ORIENTATION,
          ExifInterface.ORIENTATION_NORMAL));
      rotation = rot;
    } catch (IOException e) {
      //
    }
    Matrix matrix = new Matrix();
    if (rotation != 0f) {
      matrix.preRotate(rotation);
    }

    Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0,
        bitmap.getWidth(), bitmap.getHeight(), matrix, true);

    return resizedBitmap;
  }

  private static float exifOrientationToDegrees(int exifOrientation) {
    if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {
      return 90;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {
      return 180;
    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {
      return 270;
    }
    return 0;
  }

  public static boolean removeLoadingDialog() {

    if (loadingDialog != null && loadingDialog.isShowing()) {
      loadingDialog.dismiss();
      return true;
    }
    return false;
  }

  public static void showLoadingDialog(Context context,
      OnCancelListener cancelListener) {
    try {

      removeLoadingDialog();
      loadingDialog = ProgressDialog.show(context, "",
          context.getString(R.string.please_wait), true);
      loadingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
      if (cancelListener != null) {
        loadingDialog.setCancelable(true);
        loadingDialog.setOnCancelListener(cancelListener);
      } else {
        loadingDialog.setCancelable(false);
      }
    } catch (Exception e) {
      //
    }

  }

  public static void showConnectionErrorDialog(Context context) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(R.string.error_connection)
        .setNeutralButton("OK", null);
    final AlertDialog alert = builder.create();
    alert.show();
  }

}




Java Source Code List

de.dom.drupalit.IssueDetail.java
de.dom.drupalit.IssueParser.java
de.dom.drupalit.Main.java
de.dom.drupalit.Utils.java
de.dom.drupalit.adapters.FeedAdapter.java
de.dom.drupalit.backgroundservice.AppService.java
de.dom.drupalit.backgroundservice.OnAlarmReceiver.java
de.dom.drupalit.backgroundservice.OnBootReceiver.java
de.dom.drupalit.backgroundservice.WakefulIntentService.java
de.dom.drupalit.listeners.RSSItemClickListener.java
de.dom.drupalit.objects.Comment.java
de.dom.drupalit.objects.Issue.java
de.dom.drupalit.tabs.IssueListActivity.java
de.dom.drupalit.tabs.TabAllIssues.java
de.dom.drupalit.tabs.TabMyIssues.java
de.dom.drupalit.tabs.TabProfile.java
org.mcsoxford.rss.Dates.java
org.mcsoxford.rss.MediaAttributes.java
org.mcsoxford.rss.MediaThumbnail.java
org.mcsoxford.rss.RSSBase.java
org.mcsoxford.rss.RSSConfig.java
org.mcsoxford.rss.RSSException.java
org.mcsoxford.rss.RSSFault.java
org.mcsoxford.rss.RSSFeed.java
org.mcsoxford.rss.RSSHandler.java
org.mcsoxford.rss.RSSItem.java
org.mcsoxford.rss.RSSLoader.java
org.mcsoxford.rss.RSSParserSPI.java
org.mcsoxford.rss.RSSParser.java
org.mcsoxford.rss.RSSReaderException.java
org.mcsoxford.rss.RSSReader.java
org.mcsoxford.rss.Resources.java