Skip to content

Instantly share code, notes, and snippets.

@firehawk895
Created December 13, 2015 12:48
Show Gist options
  • Save firehawk895/b851276305ad4d1e9ada to your computer and use it in GitHub Desktop.
Save firehawk895/b851276305ad4d1e9ada to your computer and use it in GitHub Desktop.
Mime type for concept Objects
String mimeType = conceptObject.getMimetype().toString();
//Log.e("", "The mime type is" + mimeType);
Boolean openInGoogleDocs = false;
switch (mimeType) {
case "application/msword":
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
case "application/vnd.openxmlformats-officedocument.wordprocessingml.template":
case "application/vnd.oasis.opendocument.text":
fileView.setImageResource(R.drawable.doc_file_type);
/* Ion.with(fileView)
.placeholder(R.drawable.doc_file_type)
.error(R.drawable.doc_file_type)
.load(conceptObject.getUrlThumb());*/
openInGoogleDocs = true;
break;
case "application/vnd.ms-excel":
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
case "application/vnd.openxmlformats-officedocument.spreadsheetml.template":
fileView.setImageResource(R.drawable.excel_file_type);
/*Ion.with(fileView)
.placeholder(R.drawable.excel_file_type)
.error(R.drawable.excel_file_type)
.load(conceptObject.getUrlThumb());*/
openInGoogleDocs = true;
break;
case "application/vnd.openxmlformats-officedocument.presentationml.template":
case "application/vnd.openxmlformats-officedocument.presentationml.slideshow":
case "application/vnd.openxmlformats-officedocument.presentationml.presentation":
case "application/vnd.openxmlformats-officedocument.presentationml.slide":
case "application/mspowerpoint":
case "application/powerpoint":
case "application/vnd.ms-powerpoint":
case "application/x-mspowerpoint":
fileView.setImageResource(R.drawable.ppt_file_type);
/* Ion.with(fileView)
.placeholder(R.drawable.ppt_file_type)
.error(R.drawable.ppt_file_type)
.load(conceptObject.getUrlThumb());*/
openInGoogleDocs = true;
break;
case "application/pdf":
fileView.setImageResource(R.drawable.pdf_file_type);
/*Ion.with(fileView)
.placeholder(R.drawable.pdf_file_type)
.error(R.drawable.pdf_file_type)
.load(conceptObject.getUrlThumb());*/
openInGoogleDocs = true;
break;
default:
Glide.with(context)
.load(conceptObject.getUrlThumb())
.centerCrop()
.placeholder(R.drawable.loading)
.error(R.drawable.exclamation_error)
.crossFade()
.dontAnimate()
.into(fileView);
/* Ion.with(fileView)
.placeholder(R.drawable.file_type)
.error(R.drawable.file_type)
.load(conceptObject.getUrlThumb());*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment