mirror of
https://github.com/moparisthebest/k-9
synced 2024-08-13 17:03:48 -04:00
astyle
This commit is contained in:
parent
f4bb321494
commit
d59600653c
@ -383,7 +383,8 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
attachment.viewButton.setEnabled(enabled);
|
attachment.viewButton.setEnabled(enabled);
|
||||||
attachment.downloadButton.setEnabled(enabled);
|
attachment.downloadButton.setEnabled(enabled);
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled)
|
||||||
|
{
|
||||||
attachment.checkViewable();
|
attachment.checkViewable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,9 @@ public class AttachmentView extends FrameLayout
|
|||||||
|| (MimeUtility.mimeTypeMatches(contentType, K9.UNACCEPTABLE_ATTACHMENT_VIEW_TYPES)))
|
|| (MimeUtility.mimeTypeMatches(contentType, K9.UNACCEPTABLE_ATTACHMENT_VIEW_TYPES)))
|
||||||
{
|
{
|
||||||
viewButton.setVisibility(View.GONE);
|
viewButton.setVisibility(View.GONE);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
checkViewable();
|
checkViewable();
|
||||||
}
|
}
|
||||||
if ((!MimeUtility.mimeTypeMatches(contentType, K9.ACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES))
|
if ((!MimeUtility.mimeTypeMatches(contentType, K9.ACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES))
|
||||||
@ -258,25 +260,32 @@ public class AttachmentView extends FrameLayout
|
|||||||
* attachment.viewButton.setEnabled(enabled); is called.
|
* attachment.viewButton.setEnabled(enabled); is called.
|
||||||
* This method is safe to be called from the UI-thread.
|
* This method is safe to be called from the UI-thread.
|
||||||
*/
|
*/
|
||||||
public void checkViewable() {
|
public void checkViewable()
|
||||||
if (viewButton.getVisibility() == View.GONE) {
|
{
|
||||||
|
if (viewButton.getVisibility() == View.GONE)
|
||||||
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!viewButton.isEnabled()) {
|
if (!viewButton.isEnabled())
|
||||||
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
Uri uri = AttachmentProvider.getAttachmentUri( mAccount, part.getAttachmentId());
|
Uri uri = AttachmentProvider.getAttachmentUri( mAccount, part.getAttachmentId());
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setData(uri);
|
intent.setData(uri);
|
||||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
if (intent.resolveActivity(mContext.getPackageManager()) == null) {
|
if (intent.resolveActivity(mContext.getPackageManager()) == null)
|
||||||
|
{
|
||||||
viewButton.setEnabled(false);
|
viewButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
// currently we do not cache re result.
|
// currently we do not cache re result.
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
Log.e(K9.LOG_TAG, "Cannot resolve activity to determine if we shall show the 'view'-button for an attachment", e);
|
Log.e(K9.LOG_TAG, "Cannot resolve activity to determine if we shall show the 'view'-button for an attachment", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user