diff options
author | 2015-09-01 21:48:05 +0000 | |
---|---|---|
committer | 2015-09-01 21:48:05 +0000 | |
commit | a6783987ff6e9b9a97e68c0b0e2d7af5c88d8080 (patch) | |
tree | 3fd819340fe0e39c35c8b9698099ed3865d14a31 /java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java | |
parent | c1ebf8ee23116fddeb2c6b3260fc7f691854b193 (diff) | |
parent | c3cc203e4ac9702e40d3e8ebad94b973f4271a3a (diff) | |
download | latinime-a6783987ff6e9b9a97e68c0b0e2d7af5c88d8080.tar.gz latinime-a6783987ff6e9b9a97e68c0b0e2d7af5c88d8080.tar.xz latinime-a6783987ff6e9b9a97e68c0b0e2d7af5c88d8080.zip |
am c3cc203e: am f52bae18: Don\'t show download toast during SUW
* commit 'c3cc203e4ac9702e40d3e8ebad94b973f4271a3a':
Don't show download toast during SUW
Diffstat (limited to 'java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java')
-rw-r--r-- | java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java index a02203d31..0517bc814 100644 --- a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java +++ b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java @@ -32,6 +32,7 @@ import android.database.sqlite.SQLiteDatabase; import android.net.ConnectivityManager; import android.net.Uri; import android.os.ParcelFileDescriptor; +import android.provider.Settings; import android.text.TextUtils; import android.util.Log; @@ -956,14 +957,23 @@ public final class UpdateHandler { WordListMetadata metadata = WordListMetadata.createFromContentValues(installCandidate); actions.add(new ActionBatch.StartDownloadAction(clientId, metadata)); final String localeString = installCandidate.getAsString(MetadataDbHelper.LOCALE_COLUMN); + // We are in a content provider: we can't do any UI at all. We have to defer the displaying // itself to the service. Also, we only display this when the user does not have a - // dictionary for this language already. - final Intent intent = new Intent(); - intent.setClass(context, DictionaryService.class); - intent.setAction(DictionaryService.SHOW_DOWNLOAD_TOAST_INTENT_ACTION); - intent.putExtra(DictionaryService.LOCALE_INTENT_ARGUMENT, localeString); - context.startService(intent); + // dictionary for this language already. During setup wizard, however, this UI is + // suppressed. + final boolean deviceProvisioned = Settings.Global.getInt(context.getContentResolver(), + Settings.Global.DEVICE_PROVISIONED, 0) != 0; + if (deviceProvisioned) { + final Intent intent = new Intent(); + intent.setClass(context, DictionaryService.class); + intent.setAction(DictionaryService.SHOW_DOWNLOAD_TOAST_INTENT_ACTION); + intent.putExtra(DictionaryService.LOCALE_INTENT_ARGUMENT, localeString); + context.startService(intent); + } else { + Log.i(TAG, "installIfNeverRequested() : Don't show download toast"); + } + Log.i(TAG, "installIfNeverRequested() : StartDownloadAction for " + metadata); actions.execute(context, new LogProblemReporter(TAG)); } |