gt:             if (mIsLocal) {
context: package org.wordpress.android.ui.media;
  
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.app.AlertDialog.Builder;
  import android.app.Fragment;
  import android.content.DialogInterface;
  import android.content.DialogInterface.OnClickListener;
  import android.database.Cursor;
  import android.graphics.Bitmap;
  import android.graphics.drawable.ColorDrawable;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.ViewGroup.LayoutParams;
  import android.view.ViewStub;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.android.volley.toolbox.ImageLoader;
  import com.android.volley.toolbox.NetworkImageView;
  
  import org.wordpress.caredear.R;
  import org.wordpress.android.WordPress;
  import org.wordpress.android.models.Blog;
  import org.wordpress.android.util.ImageUtils.BitmapWorkerCallback;
  import org.wordpress.android.util.ImageUtils.BitmapWorkerTask;
  import org.wordpress.android.util.StringUtils;
  
  import java.util.ArrayList;
  
  /**
   * A fragment display a media item's details.
   * Only appears on phone.
   */
  public class MediaItemFragment extends Fragment {
      private static final String ARGS_MEDIA_ID = "media_id";
  
      public static final String TAG = MediaItemFragment.class.getName();
  
      private View mView;
  
      private ImageView mImageView;
      private TextView mTitleView;
      private TextView mCaptionView;
      private TextView mDescriptionView;
      private TextView mDateView;
      private TextView mFileNameView;
      private TextView mFileTypeView;
      private TextView mDimensionsView;
      private MediaItemFragmentCallback mCallback;
      private ImageLoader mImageLoader;
  
      private boolean mIsLocal;
  
      public interface MediaItemFragmentCallback {
          public void onResume(Fragment fragment);
          public void onPause(Fragment fragment);
      }
  
      public static MediaItemFragment newInstance(String mediaId) {
          MediaItemFragment fragment = new MediaItemFragment();
  
          Bundle args = new Bundle();
          args.putString(ARGS_MEDIA_ID, mediaId);
          fragment.setArguments(args);
  
          return fragment;
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          mImageLoader = MediaImageLoader.getInstance();
          setHasOptionsMenu(true);
      }
  
      @Override
      public void onAttach(Activity activity) {
          super.onAttach(activity);
  
          try {
              mCallback = (MediaItemFragmentCallback) activity;
          } catch (ClassCastException e) {
              throw new ClassCastException(activity.toString() + " must implement MediaItemFragmentCallback");
          }
      }
  
      @Override
      public void onResume() {
          super.onResume();
          mCallback.onResume(this);
      }
  
      @Override
      public void onPause() {
          super.onPause();
          mCallback.onPause(this);
      }
  
      public String getMediaId() {
          if (getArguments() != null)
              return getArguments().getString(ARGS_MEDIA_ID);
          else
              return null;
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          mView = inflater.inflate(R.layout.media_listitem_details, container, false);
  
          mTitleView = (TextView) mView.findViewById(R.id.media_listitem_details_title);
          mCaptionView = (TextView) mView.findViewById(R.id.media_listitem_details_caption);
          mDescriptionView = (TextView) mView.findViewById(R.id.media_listitem_details_description);
          mDateView = (TextView) mView.findViewById(R.id.media_listitem_details_date);
          mFileNameView = (TextView) mView.findViewById(R.id.media_listitem_details_file_name);
          mFileTypeView = (TextView) mView.findViewById(R.id.media_listitem_details_file_type);
          mDimensionsView = (TextView) mView.findViewById(R.id.media_listitem_details_dimensions);
  
          loadMedia(getMediaId());
  
          return mView;
      }
  
      /** Loads the first media item for the current blog from the database **/
      public void loadDefaultMedia() {
          loadMedia(null);
      }
  
      public void loadMedia(String mediaId) {
          Blog blog = WordPress.getCurrentBlog();
  
          if (blog != null) {
              String blogId = String.valueOf(blog.getLocalTableBlogId());
  
              Cursor cursor;
  
              // if the id is null, get the first media item in the database
              if (mediaId == null) {
                  cursor = WordPress.wpDB.getFirstMediaFileForBlog(blogId);
              } else {
                  cursor = WordPress.wpDB.getMediaFile(blogId, mediaId);
              }
  
              refreshViews(cursor);
              cursor.close();
          }
      }
  
      private void refreshViews(Cursor cursor) {
          if (!cursor.moveToFirst())
              return;
  
          // check whether or not to show the edit button
          String state = cursor.getString(cursor.getColumnIndex("uploadState"));
          mIsLocal = MediaUtils.isLocalFile(state);
          if (mIsLocal && getActivity() != null) {
              getActivity().invalidateOptionsMenu();
          }
  
          // title
          mTitleView.setText(cursor.getString(cursor.getColumnIndex("title")));
  
          // caption
          String caption = cursor.getString(cursor.getColumnIndex("caption"));
          if (caption == null || caption.length() == 0) {
              mCaptionView.setVisibility(View.GONE);
          } else {
              mCaptionView.setText(caption);
              mCaptionView.setVisibility(View.VISIBLE);
          }
  
          // description
          String desc = cursor.getString(cursor.getColumnIndex("description"));
          if (desc == null || desc.length() == 0) {
              mDescriptionView.setVisibility(View.GONE);
          } else {
              mDescriptionView.setText(desc);
              mDescriptionView.setVisibility(View.VISIBLE);
          }
  
          // added / upload date
          String date = MediaUtils.getDate(cursor.getLong(cursor.getColumnIndex("date_created_gmt")));
          if (mIsLocal) {
              mDateView.setText("Added on: " + date);
          } else {
              mDateView.setText("Uploaded on: " + date);
          }
  
          // file name
          String fileName = cursor.getString(cursor.getColumnIndex("fileName"));
          mFileNameView.setText("File name: " + fileName);
  
          // get the file extension from the fileURL
          String fileURL = cursor.getString(cursor.getColumnIndex("fileURL"));
          if (fileURL != null) {
              String fileType = fileURL.replaceAll(".*\\.(\\w+)$", "$1").toUpperCase();
              mFileTypeView.setText("File type: " + fileType);
              mFileTypeView.setVisibility(View.VISIBLE);
          } else {
              mFileTypeView.setVisibility(View.GONE);
          }
  
          String imageUri = cursor.getString(cursor.getColumnIndex("fileURL"));
          if (imageUri == null)
              imageUri = cursor.getString(cursor.getColumnIndex("filePath"));
  
          inflateImageView();
  
          // image and dimensions
          if (MediaUtils.isValidImage(imageUri)) {
              int width = cursor.getInt(cursor.getColumnIndex("width"));
              int height = cursor.getInt(cursor.getColumnIndex("height"));
  
              float screenWidth;
  
              View parentView = (View) mImageView.getParent();
  
              //differentiating between tablet and phone
              if (this.isInLayout()) {
                  screenWidth =  parentView.getMeasuredWidth();
              } else {
                  screenWidth = getActivity().getResources().getDisplayMetrics().widthPixels;
              }
              float screenHeight = getActivity().getResources().getDisplayMetrics().heightPixels;
  
              if (width > 0 && height > 0) {
                  String dimensions = width + "x" + height;
                  mDimensionsView.setText("Dimensions: " + dimensions);
                  mDimensionsView.setVisibility(View.VISIBLE);
              } else {
                  mDimensionsView.setVisibility(View.GONE);
              }
  
              if (width > screenWidth) {
                  height = (int) (height / (width/screenWidth));
                  width = (int) screenWidth;
              } else if (height > screenHeight) {
                  width = (int) (width / (height/screenHeight));
                  height = (int) screenHeight;
              }
  
  