am 91a1cf1d
: Remove "view" button for .apk attachments
* commit '91a1cf1db0b2a6ee72e467c37e7845584354eaf2': Remove "view" button for .apk attachments
This commit is contained in:
commit
c7b7621003
@ -136,6 +136,15 @@ public class Email extends Application {
|
||||
"zip", "gz", "z", "tar", "tgz", "bz2",
|
||||
};
|
||||
|
||||
/**
|
||||
* Filename extensions of attachments that can be installed.
|
||||
* Entries in this list are compared to the end of the lower-cased filename, so they must
|
||||
* be lower case, and should not include a "."
|
||||
*/
|
||||
public static final String[] INSTALLABLE_ATTACHMENT_EXTENSIONS = new String[] {
|
||||
"apk",
|
||||
};
|
||||
|
||||
/**
|
||||
* Specifies how many messages will be shown in a folder by default. This number is set
|
||||
* on each new folder and can be incremented with "Load more messages..." by the
|
||||
|
@ -60,6 +60,7 @@ import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.ContactsContract.QuickContact;
|
||||
import android.provider.Settings;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateUtils;
|
||||
@ -1172,6 +1173,18 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
|
||||
attachmentInfo.allowSave = false;
|
||||
}
|
||||
|
||||
// Check for installable attachments by filename extension; hide both buttons
|
||||
extension = AttachmentProvider.getFilenameExtension(attachmentInfo.name);
|
||||
if (!TextUtils.isEmpty(extension) &&
|
||||
Utility.arrayContains(Email.INSTALLABLE_ATTACHMENT_EXTENSIONS, extension)) {
|
||||
int sideloadEnabled;
|
||||
sideloadEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.INSTALL_NON_MARKET_APPS, 0 /* sideload disabled */);
|
||||
// TODO Allow showing an "install" button
|
||||
attachmentInfo.allowView = false;
|
||||
attachmentInfo.allowSave = (sideloadEnabled == 1);
|
||||
}
|
||||
|
||||
// File size exceeded; Hide both buttons
|
||||
// The size limit is overridden when on a wifi connection - any size is OK
|
||||
if (attachmentInfo.size > Email.MAX_ATTACHMENT_DOWNLOAD_SIZE) {
|
||||
|
Loading…
Reference in New Issue
Block a user